-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Robert Baer
Sent: Monday, May 09, 2011 2:22 PM
To: R-help at r-project.org
Subject: [R] Creating Observation ID
If I have a data frame something like:
Value=rnorm(30)
Group = sample(c('A','B','C'), 30, replace=TRUE)
df = data.frame(Value, Group)
It seems like it should be simple to create an 'ObsID' column
which indicates the observation order of each Value within
each of the 3 groups. Somehow, I can't quite see how to do
it without manually sub-setting the parent data frame and
then putting it back together again.
Anyone able to get me started on a cleaner (more R-like) approach?
Thanks,
Rob
------------------------------------------
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965
[[alternative HTML version deleted]]