[R] Dataframe modification
Ramzi Feghali
ramzi_feg at yahoo.fr
Tue Mar 8 16:44:10 CET 2005
Hello,
I have a problem and wish if anybody have a quick
solution or function or if this question was asked
before and you could give me the date to look in the
archives for the response.
My problem is that I have a dataframe D[663,40] with
only one column with repeated values lines and a
factor with 4 levels.
I want to reorganize my dataframe, create a dataframe
D1[x,40*4] and put the repeated values in one line so
that all the factors will be in columns. For the
values with a missing level factor I want to keep
empty the concerning place.
For example if i a have this dataframe:
A B C
32 a 14
32 b 22
55 a 44
55 b 77
55 c 55
55 d 44
83 c 77
83 d 55
83 e 44
I want to transform it to have this one:
32 a 14 b 22
55 a 44 b 77 c 55
83 c 77 d 55 e 44
Thanks & best regards
More information about the R-help
mailing list