这是我的示例数据,直到2018年,我一直都有每月的数据,其中不同的state_ID与不同的city_ID相关联。
structure(list(state_ID = c("00001", "00001", "00001", "00001",
"00001", "00001", "00001", "00001", "00001", "00001", "00001",
"00001", "00001", "00001", "00001", "00001", "00001", "00001",
"00001", "00001", "00001", "00001", "00001", "00001", "00001",
"00001", "00001", "00001", "00001", "00001", "00001", "00001",
"00001", "00001", "00001", "00001", "00001", "00001", "00001",
"00001", "00001", "00001", "00001", "00001", "00001", "00001",
"00002", "00002", "00002", "00002", "00002", "00002", "00002",
"00002", "00002", "00002", "00002", "00002", "00002", "00002",
"00002", "00002", "00002", "00002", "00002", "00002", "00002",
"00002", "00002", "00002", "00002", "00002", "00002", "00002",
"00002", "00002", "00002", "00002", "00002", "00002", "00002",
"00002", "00002", "00002", "00002", "00002", "00002", "00002",
"00002", "00002", "00002", "00002"), city_ID = c(436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L, 436L,
436L, 436L), DATE_ = structure(c(1.404e+09, 1406419200, 1409443200,
1411862400, 1414281600, 1417305600, 1419724800, 1422144000, 1424563200,
1427587200, 1430006400, 1433030400, 1435449600, 1437868800, 1440892800,
1443312000, 1445731200, 1448755200, 1451174400, 1454198400, 1456617600,
1459036800, 1461456000, 1464480000, 1466899200, 1469923200, 1472342400,
1474761600, 1477785600, 1480204800, 1482624000, 1485648000, 1488067200,
1490486400, 1493510400, 1495929600, 1498348800, 1501372800, 1503792000,
1506211200, 1509235200, 1511654400, 1514678400, 1517097600, 1519516800,
1521331200, 1.404e+09, 1406419200, 1409443200, 1411862400, 1414281600,
1417305600, 1419724800, 1422144000, 1424563200, 1427587200, 1430006400,
1433030400, 1435449600, 1437868800, 1440892800, 1443312000, 1445731200,
1448755200, 1451174400, 1454198400, 1456617600, 1459036800, 1461456000,
1464480000, 1466899200, 1469923200, 1472342400, 1474761600, 1477785600,
1480204800, 1482624000, 1485648000, 1488067200, 1490486400, 1493510400,
1495929600, 1498348800, 1501372800, 1503792000, 1506211200, 1509235200,
1511654400, 1514678400, 1517097600, 1519516800, 1521331200), class = c("POSIXct",
"POSIXt"), tzone = "UTC"), value = c(175.81640448, 175.63913856,
176.406913536, 189.90377088, 203.23923648, 232.85606087743, 257.99215104,
283.66071936, 271.38357504, 267.250732032, 268.928352, 275.858909184,
296.18742528, 296.67188352, 321.60720384, 323.3726592, 304.4304192,
317.916162048, 339.82880256, 353.526595584, 334.11075456, 374.4671808,
384.64440576, 374.4813312, 386.65659264, 309.52533504, 338.709529860565,
335.95442304, 291.20721344, 189.42136016, 345.55611264, 284.379576832,
364.26294144, 348.0561024, 356.95953408, 381.45053184, 399.6471744,
411.383721984, 341.01576384, 169.67886144, 166.71692544, 229.002507780565,
210.709393009355, 129.83239632, 186.77904096, 199.03727138742,
217.75355904, 202.74088512, 214.35128832, 206.65861632, 207.05547072,
230.90021831743, 260.32053504, 280.698912, 278.942976, 292.585402368,
295.38779904, 309.370555392, 309.17826432, 322.06284672, 317.232003072,
348.15669888, 328.85735424, 440.925229056, 452.2647936, 505.882254336,
512.65638528, 533.06049024, 563.41078272, 563.734646784, 555.21101184,
459.154031616, 511.35196690356, 518.53857792, 237.594366592,
265.52476272, 26.70911584, 570.316075008, 560.95298688, 531.25721472,
540.957133824, 534.50769024, 579.9181248, 591.968553984, 318.88770064,
244.57011072, 229.676840448, 301.25467474356, 314.062592568545,
152.38488576, 114.50917472, 170.496469876475)), row.names = c(NA,
-92L), class = c("grouped_df", "tbl_df", "tbl", "data.frame"), vars = c("state_ID",
"city_ID"), drop = TRUE, indices = list(0:45, 46:91), group_sizes = c(46L,
46L), biggest_group_size = 46L, labels = structure(list(state_ID = c("00001",
"00002"), city_ID = c(436L, 436L)), row.names = c(NA, -2L), class = "data.frame", vars = c("state_ID",
"city_ID"), drop = TRUE))
想获取每个组的框图(按state_ID分组)并检测异常值
有人可以帮我做R