[R] Transformation of a data frame
Des Callaghan
descall at blueyonder.co.uk
Tue Sep 12 08:43:17 CEST 2006
Dear R-helpers,
Apologies in advance for this (probably) simple question. I've searched the
R Archive and can't seem to find a solution to my problem.
I have a data frame of vegetation quadrat data with the following format:
Q S C
1 A 5
1 B 10
1 C 50
1 D 10
2 A 20
2 E 10
2 C 40
3 D 5
3 F 1
3 G 5
3 B 75
Where Q is the sample (vegetation quadrats), S is the species and C is the
percentage cover of each species within the sample. I wish to transform
this into a community data matrix for analysis within the vegan package,
which needs the following data frame format:
Q A B C D E F G
1 5 10 50 10 0 0 0
2 20 0 40 0 10 0 0
3 0 75 0 5 0 1 75
I can't manage to do this transformation so your help would be much
appreciated. Thanks very much in advance.
All the best,
Des
More information about the R-help
mailing list