se: Standard Error

Description Usage Arguments Details Author(s) See Also Examples

Description

This function computes the standard error of the values in x. If na.rm is TRUE then missing values are removed before computation proceeds.

Usage

1
se(x, na.rm=FALSE)

Arguments

x

A numeric vector.

na.rm

A logical. Should missing values be removed? See details for implementation.

Details

If na.rm=TRUE then na.rm=TRUE is passed to sd and n is calculated as length(na.omit(x)).

Note this might have unexpected consequences for matrixes or dataframes, which is why x MUST be a vector.

Author(s)

Daniel Pritchard

See Also

sd, na.omit. length.

Examples

1
2
3
4
5
6
dat <- c(1,2,3,4,5)
se(dat) # 0.7071068

dat_na <- c(1,2,3,4,NA)
se(dat_na) # NA
se(dat_na, na.rm=TRUE) # 0.6454972

dpritchard/takiwaR documentation built on May 15, 2019, 1:50 p.m.