Hey R list,
Can someone help me with following question?
I can create a listing of the unique observations in a dataframe by using:
df <- df [order(df $start),]
df $first_ob[!duplicated(df $ID)] <- "1"
df $first_ob[duplicated(df $ID)] <- "0"
Now I want to hold specific attributes of the first observation for other
(the second or third
) observation of a specific element (named ID).
So for example if I have an element with ID X that is ok in the first
observation and not ok in the second I want to hold the ok in a
therefore specified column. An example of the output would be:
ID start first ob T1 T2
X 1/1/2010 1 ok ok
X 2/2/2010 0 not ok ok
Thanks in advance.
Kind regards,
John
[[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.