美文网首页
R语言 count()报错

R语言 count()报错

作者: 小川向大海 | 来源:发表于2021-08-18 14:31 被阅读0次

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


相关文章

网友评论

      本文标题:R语言 count()报错

      本文链接:https://www.haomeiwen.com/subject/ujugbltx.html