Is it possible to R function that takes another function (with arguments) as an input.

The input data is ideally being feed into the nestedFunction.

My intention is to use a for loop to iterate through a vector of grouping variable combinations in order to compute the same statistics for every variation. The tricky thing is the output of each computation has the grouping variables as columns which I transform into col_vars, col_content, col_vars_content. If there are 2 or more variables used in that step's grouping then those variables would be a vector of lists.

The reason for avoiding apply or lapply thus far was because I am using those functions to create those nested lists rowwise and thought debugging would be a nightmare.

/r/Rlanguage Thread Parent