# Apply Family in R
data(mtcars)
data(iris)
#iris
#dim(iris)
#head(iris,5)
#apply(iris[,(1:4)], MARGIN=2, FUN=max)

# lapply always returns a list 
l = lapply(iris[,(1:4)],FUN = mean)
class(l)

#sapply always reutrn the simplified form of the data or vector.
v = sapply(iris[,1:4], FUN=max)
class(v)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: