Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 24
Example: Mean
ОглавлениеAn example of a function is mean()
, as the name suggests it calculates the arithmetic mean (average) of data fed into the function.
# First, generate some data: x <- c(1,2,3) # Then calculate the mean: mean(x) ## [1] 2
Some example environments are split in two parts: the question and the solution as follows: