Description Usage Arguments Details Value See Also Examples
[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## 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.