ma_function: Ma super fonction = Arithmetic mean

Description Usage Arguments Details Value Examples

View source: R/ma_function.R

Description

This function computes the arithmetic mean of a numerical vector.

Usage

1
ma_function(x, na_rm = FALSE)

Arguments

x

a numerical vector (can contain 'NA' values).

na_rm

a logical value indicating whether 'NA' values should be stripped before the computation proceeds.

Details

An error will be returned if 'x' contains 'NA' values and 'na_rm' is set to 'FALSE' or if 'x' contains less than two values (after removing 'NA').

Value

The arithmetic mean of the values as a numeric vector of length one.

Examples

1
2
3
ma_function(1:10)
 {
ma_function(c(1:10, NA)) # Error

MaelDore/newpackage documentation built on Dec. 31, 2020, 2:18 p.m.