Apply List of functions on List of columns based on different combinations
I have a dataframe df with three categorical variables cat1 , cat2 , cat3 and two continuous variables con1 , con2 . I would like to compute list of functions sd , mean on list of columns con1 , con2 based on different combinations of list of columns cat1 , cat2 , cat3 . I have done them explicitly subsetting all different combinations. # Random generation of values for categorical data set.seed(33) df <- data.frame(cat1 = sample( LETTERS[1:2], 100, replace=TRUE ), cat2 = sample( LETTERS[3:5], 100, replace=TRUE ), cat3 = sample( LETTERS[2:4], 100, replace=TRUE ), con1 = runif(100,0,100), con2