View source: R/sparse_median.R
sparse_median | R Documentation |
Calculate median from sparse vectors
sparse_median(x, na_rm = FALSE)
x |
A sparse numeric vector. |
na_rm |
Logical, whether to remove missing values. Defaults to |
This function, as with any of the other helper functions assumes that the
input x
is a sparse numeric vector. This is done for performance reasons,
and it is thus the users responsibility to perform input checking.
single numeric value.
sparse_median(
sparse_double(1000, 1, 1000)
)
sparse_median(
sparse_double(1000, 1, 1000, default = 1)
)
sparse_median(
sparse_double(c(10, 50, 11), c(1, 50, 111), 1000)
)
sparse_median(
sparse_double(c(10, NA, 11), c(1, 50, 111), 1000)
)
sparse_median(
sparse_double(c(10, NA, 11), c(1, 50, 111), 1000),
na_rm = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.