| wrapper - s and summary funs | R Documentation |
[summary function_*] functions are simple wrappers of aggregate function
and the s function. s removes all non-values,
i.e. NA,Inf,NaN from a vector.
However, if the length is 0 it returns NA. The result is then passed to the
corresponding aggregation function. For example,
min_(x) is identical to min(s(x)). Please read vignette("s") for more information.
max_(.x, ignore_na = TRUE)
min_(.x, ignore_na = TRUE)
sum_(.x, ignore_na = TRUE)
mean_(.x, ignore_na = TRUE)
median_(.x, ignore_na = TRUE)
sd_(.x, ignore_na = TRUE)
var_(.x, ignore_na = TRUE)
first_(.x, ignore_na = TRUE)
last_(.x, ignore_na = TRUE)
first_non_na(.x)
squeeze(.x, ignore_na = FALSE)
squeeze_(.x, ignore_na = TRUE)
.x |
a single vector |
ignore_na |
if false missing values are not omitted. |
'first_non_na' is a faster version of 'first' since it only search for a non NA value until it finds one. 'squeeze' on the other hand checks if all elements are equal and then returns only that value.
a single aggregated value
vignette("convert"), vignette("hablar")
## sum_ on non-rational numeric vector
vector <- c(7, NaN, -Inf, 4)
sum_(vector)
## Min of vector with length 0
vector <- c()
# With a wrapped s
min_(vector)
## Max of vector with only NA
# With a wrapped s
max_(vector)
## Use of s when NA should not be removed
vector <- c(7, Inf, NA, 4)
# With a wrapped s
sum_(vector, ignore_na = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.