I am just assuming this can be done, but I have not gotten close to
making it happen. I have a data file with about 1 million rows with
1470 unique subjects. Each row represents a small set of observations
made on a specific date for a single subject. I would like to
transform the data so that I have an R object with a single entry for
each subject and start date and vectors for the observation dates and
the observations. The data are something like the following where for
each subject the subject_id does not change and the start_date does
not change, but the obeservation_date and the three different
observations change between rows. (There is one row for each day for
each subject over a three year period although some entered the study
late):
'subject_id', 'start_date','observation_date','weight_obs',
'activity_obs','calories_obs'
1,'1/1/2005','1/1/2005',3.26,'a',93
1,'1/1/2005','1/2/2005',3.22,'o',85
1,'1/1/2005','1/3/2005',3.28,'o',91
...
1,'1/1/2005','12/31/2008',4.38,'h',102
2,'2/13/2005','2/13/2005',3.02,'l',80
2,'2/13/2005','2/14/2005',3.08,'j',85
...
Any guidance is appreciated.
R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Center
Southwest Foundation for
Biomedical Research
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: [email protected]
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.