-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsparse_sd.Rd
49 lines (42 loc) · 1.06 KB
/
sparse_sd.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
48
49
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sparse_sd.R
\name{sparse_sd}
\alias{sparse_sd}
\title{Calculate standard diviation from sparse vectors}
\usage{
sparse_sd(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 standard diviation 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.
Much like \code{\link[=sd]{sd()}} it uses the denominator \code{n-1}.
}
\examples{
sparse_sd(
sparse_double(1000, 1, 1000)
)
sparse_sd(
sparse_double(1000, 1, 1000, default = 1)
)
sparse_sd(
sparse_double(c(10, 50, 11), c(1, 50, 111), 1000)
)
sparse_sd(
sparse_double(c(10, NA, 11), c(1, 50, 111), 1000)
)
sparse_sd(
sparse_double(c(10, NA, 11), c(1, 50, 111), 1000),
na_rm = TRUE
)
}