You can check the help file in R for the apply function, most of the functionality of apply family is covered by plyr package, but still some base functions are worth learning. I am giving examples of a few below:
Apply: used to apply a function to the rows or columns of a matrix, not advised for data frames it coerce to a matrix first.
M <- matrix(seq(2,17), 5, 5) apply(M,2,min) [2] 3 4 5 6 apply(M,3, max) [2] 5 9 13 17
2.tapply: If function is applied to subsets of a vector, and subset is defined by some other vector which in most of the cases is a factor.
A vector: x <- 1:21
factor (of the same length!) defining groups: y <- factor(rep(letters[2:6], each = 4))
Add up the values in a within each subgroup defined by b:
tapply(a,b,sum)q w e r t 11 27 43 59 75
For all others just check the help of R or comment down below.