【发布时间】:2018-05-13 10:24:52
【问题描述】:
来自:Use filter() (and other dplyr functions) inside nested data frames with map()
我想嵌套在多列上,然后按嵌套在该行中的项目数过滤掉行。例如,
df <- tibble(
a = sample(x = c(rep(c('x','y'),4), 'w', 'z')),
b = sample(c(1:10)),
c = sample(c(91:100))
)
我想嵌套在a列上,如:
df_nest <- df %>%
nest(-a)
然后,我想过滤掉数据列中只有 1 个观察值的行(在本例中为 a = w 或 a = z)。我该怎么做?
【问题讨论】:
标签: r dataframe nested dplyr tidyverse