1.数据集df

错误代码
> df%>%count(name)
Error in count(., name) : object 'name' not found
正确代码
> df %>%dplyr::count(name,type)# 注意指定dplyr包
# A tibble: 6 x 3
name type n
<chr> <chr> <int>
1 Alice english 1
2 Alice math 1
3 Bob english 1
4 Bob math 1
5 Carol english 1
6 Carol math 1
网友评论