complex transformation of data
Denis, Have a look at paste(), aggregate(), ddply() (from the plyr package) and melt() and cast() (both from the reshape package). Best regards, Thierry ---------------------------------------------------------------------------- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey
-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] Namens Den
Verzonden: vrijdag 21 januari 2011 13:26
Aan: R-help
Onderwerp: [R] complex transformation of data
Dear [R] people
Could you please help with following data transformation.
Any suggestions, hints, references and even guessing on
performing any of the following steps are highly appreciated.
Those transformations are crucial for my work.
(n_, _n, j_, k_ signify numbers)
SOURCE DATA:
id cycle1 cycle2 cycle3 ... cycle_n
1 c c c c
1 m m m m
1 f f f f
2 m m m NA
2 f f f NA
2 c c c NA
3 a a NA NA
3 c c c NA
3 f f f NA
3 NA NA m NA
...........................................
RESULT DATA1:
id cyc1 cyc2 cyc3 ... cyc_n
1 cfm cfm cfm cfm
2 cfm cfm cfm NA
3 acf acf cfm NA
...........................................
RESULT DATA2:
id treatment
1 n_cfm
2 j_cfm
3 2acf->k_cfm
...................
RESULT DATA3:
id regimen numOfCycles
1 cfm n_
2 cfm j_
3 asf->cfm {2+k_}
.............................
Thank you
Denis
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.