R using dplyr package not recognizing a comumn name

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:

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


totals <- my_data %>% 
    group_by(Behaviour_zoo, Odin_Lars) %>% 
    summarise() # Here you have to add anny summarizacion operation you want to perform by groups

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

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.