http://www.thepcmasterrace.com/forums/?mingleforumaction=viewtopic&t=8.0#postid-21
为什么当我尝试通过blockquote发布时会发生这种情况。
df <- structure(list(ID = c(11084L, 67985L, 11084L, 34084L, 11043L,
23084L, 11084L, 54328L), P1 = c(23L, 76L, 34L, 56L, 90L, 55L,
77L, 89L), P2 = c(43L, 12L, 64L, 77L, 54L, 32L, 14L, 56L), Year = c(2001L,
2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L), Month = structure(c(1L,
5L, 4L, 3L, 2L, 8L, 7L, 6L), .Label = c("April", "August", "July",
"June", "May", "November", "October", "September"), class = "factor"),
A = c(41.9, 6.9, -999, NA, NA, 50.8, 0, -999), B = c(-99.99,
123, -99.99, -99.99, -99.99, -99.99, -99.99, -99.99), A_miss = c("No",
"No", "Yes", "Yes", "Yes", "No", "No", "Yes")), .Names = c("ID",
"P1", "P2", "Year", "Month", "A", "B", "A_miss"), row.names = c(NA,
-8L), class = "data.frame")
df$A_miss <- ifelse(df$A == -999 | is.na(df$A), "yes", "no")
df$B_miss <- ifelse(df$B == -99.99 | is.na(df$B), "yes", "no")
ID P1 P2 Year Month A B A_miss B_miss
1 11084 23 43 2001 April 41.9 -99.99 no yes
2 67985 76 12 2001 May 6.9 123.00 no no
3 11084 34 64 2001 June -999.0 -99.99 yes yes
4 34084 56 77 2001 July NA -99.99 yes yes
5 11043 90 54 2001 August NA -99.99 yes yes
6 23084 55 32 2001 September 50.8 -99.99 no yes
7 11084 77 14 2001 October 0.0 -99.99 no yes
8 54328 89 56 2001 November -999.0 -99.99 yes yes