Hi all,
Assume that I have a data set (xcv) with several variables and some of the variables have a missing observation represented by -9 as shown below. I want to exclude these observations from the analysis ( as a NA). Is there a command that I can do it for the entire data set rather than one by one for each variable ( tmp <- xcv[xcv$v1 != -9, ]) V1 v2 v3 v4 11 23 14 -9 12 -9 21 3 -9 30 41 25 15 07 -9 10 and I want the results as follows V1 v2 v3 v4 11 23 14 NA 12 NA 21 3 NA 30 41 25 15 07 NA 10 The second question is I want to calculate the number of days between two dates Start end number of days 20020626 20020805 40 20030101 20030421 110 How do I do it in R? Thanks in advance [[alternative HTML version deleted]]
______________________________________________ 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.