I am trying to create a group bar chart with 2 bars for each variable in R, however, when I am stating my totals and what to group by, R says my column title cannot be found. Below is my code:
totals<-my_data
group_by(Behaviour_zoo, Odin_Lars)
Error in group_by(Behaviour_zoo, Odin_Lars) :
object 'Behaviour_zoo' not found.
I have made sure the spelling is correct, any help would be appreciated.
You are not linking the group_by() command with the pipe operator so you are not passing a data frame as the first argument for the group_by() function, I think the code should be something like this
library(dplyr)
totals <- my_data %>%
group_by(Behaviour_zoo, Odin_Lars) %>%
summarise() # Here you have to add anny summarizacion operation you want to perform by groups