我有一些指示循环模式的因子值:
BM HB HFA HFZ HM HNA HNFA HNFZ HNZ NEA NEZ NWA NWZ NA NZ SA SEA SEZ SWA SWZ SZ TB TM TRM TRW U WA WS WW WZ
其中一个因素,就是所谓的流通模式NA
。当我使用该数据时,R 将NA
模式解释为缺失值。有没有办法对 R 说这NA
是一个合适的值?
这是一些数据示例:
df <- structure(list(data = structure(list(sec = c(0, 0, 0, 0, 0, 0,
0, 0, 0, 0), min = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
hour = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), mday = c(21L,
21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L), mon = c(0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), year = 46:55, wday = c(1L,
2L, 3L, 5L, 6L, 0L, 1L, 3L, 4L, 5L), yday = c(20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L), isdst = c(0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("sec", "min", "hour",
"mday", "mon", "year", "wday", "yday", "isdst"), class = c("POSIXlt",
"POSIXt")), gwl = structure(c(4L, NA, 24L, 14L, 4L, 14L, 12L,
13L, 14L, 2L), .Label = c("", "BM", "HB", "HFA", "HFZ", "HM",
"HNA", "HNFA", "HNFZ", "HNZ", "NEA", "NEZ", "NWA", "NWZ", "NZ",
"SA", "SEA", "SEZ", "SWA", "SWZ", "SZ", "TB", "TM", "TRM", "TRW",
"U", "WA", "WS", "WW", "WZ"), class = "factor")), .Names = c("data",
"gwl"), row.names = 2546:2555, class = "data.frame")