【发布时间】:2020-07-16 01:03:45
【问题描述】:
运行以下脚本时不断收到此错误 - 在 dplyr 包中使用汇总
analysis <- df %>% group_by(Year, Week, YearWeek, Cad.Name, CamName, Abs.ID, Place.Name, Pull.Name) %>%
summarise(visits=sum(Visits)) %>%
group_by(Year, Week, YearWeek, Cad.Name, CamName, Abs.ID, Place.Name) %>%
summarise(video=unique(Video.Name),visits=sum(Visits)) %>%
arrange(Year,Week)
Video.Name 是一个问题,需要在汇总之前将其添加到 groupby 以使其执行。我需要通过访问期间的唯一视频数来总结 - 有什么想法吗?我不断收到这些错误:
Error: Expecting a single value: [extent=2].
In addition: Warning messages:
1: Factor `YearWeek` contains implicit NA, consider using `forcats::fct_explicit_na`
2: Factor `YearWeek` contains implicit NA, consider using `forcats::fct_explicit_na`
【问题讨论】:
-
如果没有您的任何数据,很难准确地说。 See here 提出一个人们可以更轻松地帮助解决的 R 问题
标签: r error-handling dplyr