Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'data collapse in Mathematica' topicStudent Support Forum > General > "data collapse in Mathematica"

Next Comment >Help | Reply To Topic
Author Comment/Response
David
09/20/08 3:47pm

Hello. I am using Mathematica to collapse my data.
Below is my data.

A   B   C   D   E   F
1   1   1   0.1   23   2
2   1   1   0.1   45   3
3   1   1   0.1   56   5
4   1   1   0.1   74   6
5   1   1   0.1   43   8
1   1   2   0.2   45   54
2   1   2   0.2   45   4
3   1   2   0.2   32   3
4   1   2   0.2   46   5
5   1   2   0.2   57   78
1   2   1   0.3   56   5
2   2   1   0.3   48   3
3   2   1   0.3   34   5
4   2   1   0.3   75   78
5   2   1   0.3   34   5
1   2   2   0.4   67   3
2   2   2   0.4   35   4
3   2   2   0.4   37   4
4   2   2   0.4   47   4
5   2   2   0.4   26   54

A = {1,2,3,4,5} and this set is repeated four times. B,C,D are systematically sorted. E is the outcome variable which is my major interest. F is an irrelevant variable.

Here are my questions.

(1) How do I sort the data by the ascending(or descending) order of B or C or D? For example, when B is being sorted, the corresponding values of other variables should be moved following the order of B.

(2) I want to select all the variables except F.
I could simply drop the F column. But instead of doing so, could somebody tell me how to just select A,B,C,D,E.

(3) Then, I want to collapse my data. Because A consists of four sets and each set has five lines in which all the values of B(C, D too) are same.

I want to condense the 20 lines into 4 lines such like the following table.

A   B   C   D   E
1   1   1   0.1   (23+45+56+74+43)/5
2   1   2   0.2   (45+45+32+46+57)/5
3   2   1   0.3   (56+48+34+75+34)/5
4   2   2   0.4   (67+35+37+47+26)/5

Here A now represents four sets.
In each set B, C, D have only one value as you saw in the previous table.

The trickiest thing is E. I want to record the mean of five values(in each set) of E in the new table. This is a real challenge to me.

Because I have a really really huge data, this is the only way I can deal with this data. Luckily, the data has some orders.

Many thanks in advance.

URL: ,

Subject (listing for 'data collapse in Mathematica')
Author Date Posted
data collapse in Mathematica David 09/20/08 3:47pm
Re: data collapse in Mathematica Forum Modera... 09/23/08 08:45am
Re: Re: data collapse in Mathematica David 09/23/08 10:25am
Next Comment >Help | Reply To Topic