swh:1:snp:81eadaa089e8253d8469bcef66aa332632c6c669
Tip revision: 1305bf51cc38adca02d0c8a834c61a4c7e038309 authored by Hans W. Borchers on 08 February 2015, 00:00:00 UTC
version 1.8.3
version 1.8.3
Tip revision: 1305bf5
std.R
##
## s t d . R
##
std <- function(x, flag=0) {
if (length(x) == 0) return(c())
if (!is.numeric(x))
stop("Argument 'x' must be a numeric vector or matrix.")
n <- if (flag == 0) length(x) - 1 else length(x)
sqrt(sum((x-mean(x))*(x-mean(x)))/n)
}
std_err <- function(x) {
if (length(x) == 0) return(c())
if (!is.numeric(x))
stop("Argument 'x' must be a numeric vector or matrix.")
sqrt(var(x)/length(x))
}