I am trying to find the summary statistics for different factor levels.
data.frame(apply(final_data[Company=="BPO",c(66:84)],2,summary))
Now I have different values for company
- i can repeat the statement for different values. I know it can be automated - using apply family (ddply
,tapply
,sapply
), but I am not getting it right.
You could split on company and then use your function:
spl = split(final_data, final_data$Company)
list.of.summaries = lapply(spl, function(x) data.frame(apply(x[,66:84], 2, summary)))