-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsparse_median.Rd
47 lines (41 loc) · 1 KB
/
sparse_median.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sparse_median.R
\name{sparse_median}
\alias{sparse_median}
\title{Calculate median from sparse vectors}
\usage{
sparse_median(x, na_rm = FALSE)
}
\arguments{
\item{x}{A sparse numeric vector.}
\item{na_rm}{Logical, whether to remove missing values. Defaults to \code{FALSE}.}
}
\value{
single numeric value.
}
\description{
Calculate median from sparse vectors
}
\details{
This function, as with any of the other helper functions assumes that the
input \code{x} is a sparse numeric vector. This is done for performance reasons,
and it is thus the users responsibility to perform input checking.
}
\examples{
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
)
}