7.5 Apply (in base R)
apply family of functions
7.5.1 lapply
7.5.4 mapply
7.5.5 apply (2-dimensions)
apply(mtcars, MARGIN = 1, mean)
## Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
## 29.90727 29.98136 23.59818 38.73955
## Hornet Sportabout Valiant Duster 360 Merc 240D
## 53.66455 35.04909 59.72000 24.63455
## Merc 230 Merc 280 Merc 280C Merc 450SE
## 27.23364 31.86000 31.78727 46.43091
## Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
## 46.50000 46.35000 66.23273 66.05855
## Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
## 65.97227 19.44091 17.74227 18.81409
## Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
## 24.88864 47.24091 46.00773 58.75273
## Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
## 57.37955 18.92864 24.77909 24.88027
## Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
## 60.97182 34.50818 63.15545 26.26273