I’m pretty new to R and programming itself,and right now I have an issue with my data.frame that is not allowing me to continue my work.
I have a set of data as follows
Table 1
Individual Score
Tim 45
Tim 77
Tim 32
Clare 92
Clare 70
Clare 88
Let me explain the table 1 above, I have several individuals (TIm and Clare in the example above) and I have their score in a test they presented in 3 different occasions (2009, 2010, 2011) I am trying to figure out a way to turn that above into something like this:
Table2
Individual Score09 Score10 Score11
Tim 45 77 32
Clare 92 70 88
I used ddply to obtain the Table 1, since I originally had the information of the subsets of the test (the variable score is just the sum of all the subset)
Please let me know if there a way to actually end up with Table 2 instead of Table 1, Since I have over 10000 observations and the Table 1 set up wont let me move forward with the intended propose.
EDIT:
The original df from where Table 1 was generated is:
The data frame is as follows
Base Individual score_math score_bio score_chem
SB1120091 Tim 12 23 10
SB1120092 Tim 30 25 22
SB1120101 Tim 17 5 10
SB1120091 Clare 50 20 22
SB1120092 Clare 40 10 20
SB1120101 Clare 47 20 21
And the code was:
>Table1 <-ddply(x, .(Indivual), summarise, Score=(score_math*score_bio*score_chem))
EDIT2:
The original data set has no Year variable but a base variable that provides information about when the test was taken.
Also The Score variable is calculated with as a product of all the subsets scores.
The data:
Using
reshapefrom base stat: