Hello! I am trying the following code but it does not group by the selected variables and I am not sure how to debug it.
y<- sample_final %>%
group_by(a,b) %>%
summarise(
avg= mean(y)
)
Anyone knows why? Thanks!
You are trying to summarize a non-existant tibble or data.frame. You need to be summarizing a variable in sample_final
Try this"
sample_final <- data.frame(a = rep(1:2, 10, replace = TRUE),b = rep(c("x", "y"), 10, replace = TRUE), c = c(1,3,7,9,5,12,4, 5,9,6))
y <- sample_final %>%
group_by(a, b) %>%
summarise(avg= mean(c))
system
Closed
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.