I have a data frame which consists of numeric and character vectors for which i am trying to sum all vectors and divide it by 4, my code is as below
df2 = df1%>%
group_by(city,name,day,hour, age ,sex) %>%
summarise_if(is.numeric, function(x) sum(x/4,na.rm =T))
how can we write a same code in data.table package , so that we can save the time. Thanks in advance.