Keep getting this error when running the below script - using summarise in dplyr package
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 was an issue and needed to add it to the groupby before summarise to get it to execute. I need to summarise by unique count of videos along my visits - any thoughts? I keep getting these errors:
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`