2
$\begingroup$

Let's say there is imported 1D horizontal data such as:

{{1, 0.01, 4, 0.05, 5, 0.003, 6, 0.07, 31, 0.1, 8, 0.82, 9, 0.74, 11, 0.1, 40, 0.03, 30, 0.05, 53, 0.07, 121, 0.001, 45, 0.06 ...}} (*thousand data*)

I would like to re-arrange it to two columns to calculate some statistics.

As you can see the above 1D data, 1st, 3rd, 5th, 7th, 9th, ... data has random value and 2nd, 4th, 6th, 8th ... data has its error percentage.

How can I change horizontal dataset to vertical that has two column?

1 0.01
4 0.05
5 0.003
6 0.07
31 0.1
8 0.82

AND how can I select the first column only and the second column only?

Thank you so much in advance

$\endgroup$

closed as off-topic by Kuba, corey979, m_goldberg, Bob Hanlon, MarcoB Feb 11 '17 at 2:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba, corey979, m_goldberg, Bob Hanlon, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

1
$\begingroup$

Similar to the comment by March:

In[1]:= data = {{1, 0.01, 4, 0.05, 5, 0.003, 6, 0.07, 31, 0.1, 8, 
    0.82, 9, 0.74, 11, 0.1, 40, 0.03, 30, 0.05, 53, 0.07, 121, 0.001, 
    45, 0.06 ...}} ;

In[2]:= partitioned = Partition[data[[1]], 2]

Out[2]= {{1, 0.01}, {4, 0.05}, {5, 0.003}, {6, 0.07}, {31, 0.1}, {8, 
  0.82}, {9, 0.74}, {11, 0.1}, {40, 0.03}, {30, 0.05}, {53, 
  0.07}, {121, 0.001}, {45, 0.06 ...}}

In[3]:= {column1, column2} = Transpose[partitioned]

Out[3]= {{1, 4, 5, 6, 31, 8, 9, 11, 40, 30, 53, 121, 45}, {0.01, 0.05,
   0.003, 0.07, 0.1, 0.82, 0.74, 0.1, 0.03, 0.05, 0.07, 0.001, 
  0.06 ...}}
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.