Error in View : Must group by variables found in `.data`.

Hello everyone,

I am working on my first case study so not sure what to do with this error, how can I solve it?
The code I am trying to run:
calories_narrow <- read.csv( "minuteCaloriesNarrow_merged.csv")
intensities_narrow <- read.csv( "minuteIntensitiesNarrow_merged.csv")
steps_narrow <- read.csv("minuteStepsNarrow_merged.csv")
sleep <- read.csv( "minuteSleep_merged.csv")
met <- read.csv("minuteMETsNarrow_merged.csv")

minute <- left_join(calories_narrow,intensities_narrow)
minute <- left_join(minute,steps_narrow)
minute <- left_join(minute,met)


sleep %>% group_by(Id,ActivityMinute) %>% count() %>% View()

colnames(sleep)[2] <- "ActivityMinute"
sleep <- sleep %>% unique()
minute <- left_join(minute,sleep)

The Error I am getting:
Joining, by = c("Id", "ActivityMinute")Joining, by = c("Id", "ActivityMinute")Joining, by = c("Id", "ActivityMinute")Error in View : Must group by variables found in .data.
Joining, by = c("Id", "ActivityMinute")

Can someone help please?
Thank you

Would be more confident if the data were included as part of a cut-and-paste reprex but this can be read that ActivityMinute is missing in one or both of the objects to be joined. Hand check each step to see which.

1 Like

Thank you for your help

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.