We don't need the data$ inside the tidyverse
. The daily_activity$
extracts the full column from the data instead of the values for each group 'Id'. It is not clear which function should be applied on the ActivityDate
. If we need to return the min
or first
, apply that.
library(dplyr)
daily_activity %>%
group_by(Id)%>%
summarise(Date_exersized= min(ActivityDate), .groups = 'drop')
Instead, if we want to create a new column, use mutate
instead of summarise
. The warning message is a friendly one. We can specify the .groups
with one of the values i.e. 'drop'
removes the group attribute. By default, it removes the last group