[R] Factors to Columns
David martin
vilanew at gmail.com
Fri May 20 11:49:19 CEST 2011
> str(data)
'data.frame': 250 obs. of 3 variables:
$ student: chr "A" "B" "C" "D" ...
$ data : num 20.2 20.4 22.5 22.1 23.3 ...
$ param : Factor w/ 4 levels "AGE","SCHOOL",..: 1 1 1 1 1 1 1 1 1 1
Hi , i would like to split the dataframe so that each level of param is
a column
At the end it should look like
AGE SCHOOL ...
A 20.2 20.4
B 22.5 22.1
C 23.1 24
D 22 22.8
..
is i use that contingency table:
table(data$student,data$param) i will have such a similar table of what
i want, except that i don't need counts but real data.
How can i split levels of the dataframe into columns ??
thanks
More information about the R-help
mailing list