Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 75
4.3.5.4 Applying Functions over Arrays
ОглавлениеWhile it is possible to use a for-loop and cycle through the elements of an array, it is usually faster to use the built-in functions that R provides.
An efficient way to apply the same function over each element of an array is via the function apply()
: that functions is designed to do exactly that.
apply()