Dear friends - I hope you will forgive me another simple question, illustrated by

ID <- c(1,1,1,2,2,3,3,3)
PERIOD <- c(1,2,3,2,3,1,2,3)
X <- runif(8,0,10))

FF <- data.frame(ID=ID,PERIOD=PERIOD,X=X)

I need to the fourth value of X as NA, and ID and PERIOD is updated to 1,1,1,2,2,2,3,3,3 and 1,2,3,1,2,3,1,2,3 respectively.
How do I use the pattern in ID and PERIOD to find the lacking X and put NA?

Best wishes

Troels Ring,
Aalborg, Denmark

______________________________________________
R-help@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.

Reply via email to