Revision d5bfb0e3b7a3211ff2bbe2926e5ba31aa24e4df6 authored by HwB on 09 March 2012, 00:00:00 UTC, committed by Gabor Csardi on 09 March 2012, 00:00:00 UTC
1 parent 63e8a52
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))
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...