1
我有一个数据框,我想通过某些标准的出现一定数量的过滤行。筛选器和计数没有汇总数据帧
实施例:
yelp_tbl_asian %>% count(name) %>% filter(n > 10)
# A tibble: 16 x 2
name n
<chr> <int>
1 China Buffet 12
2 China Garden 12
3 China House 14
4 China Star 13
在该步骤之后,我想筛选/由其他标准编辑数据帧。
实施例:
yelp_tbl_asian %>% filter(rating > 3.5) %>% select(attributes) %>% dmap(unlist) %>% count(attributes) %>% arrange(desc(n))
# A tibble: 227 x 2
attributes n
<chr> <int>
1 RestaurantsTakeOut: True 3265
2 RestaurantsAttire: casual 3233
3 GoodForKids: True 2986
4 BusinessAcceptsCreditCards: True 2939
的问题是,第一步骤是消除从数据集中以下标准。所以在第一次过滤之后,第二步就不可能了。我想结合这两个命令/步骤。
也许在filter()后面使用'left_join'将它与'name'上的原始df合并? – Sotos