https://github.com/cran/fields
Revision edc2e35928199cac9fcb165e66ad178009f37726 authored by Doug Nychka on 20 April 2012, 00:00:00 UTC, committed by Gabor Csardi on 20 April 2012, 00:00:00 UTC
1 parent 041aece
Tip revision: edc2e35928199cac9fcb165e66ad178009f37726 authored by Doug Nychka on 20 April 2012, 00:00:00 UTC
version 6.7.6
version 6.7.6
Tip revision: edc2e35
describe.R
# fields, Tools for spatial data
# Copyright 2004-2011, Institute for Mathematics Applied Geosciences
# University Corporation for Atmospheric Research
# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
"describe" <- function(x) {
lab <- c("N", "mean", "Std.Dev.", "min", "Q1", "median",
"Q3", "max", "missing values")
if (missing(x)) {
return(lab)
}
temp <- rep(0, length(lab))
xt <- x[!is.na(x)]
ix <- order(xt)
n <- length(xt)
if (!is.numeric(xt) || all(is.na(x))) {
return(c(n, rep(NA, length(lab) - 2), length(x) - length(xt)))
}
if (n == 1) {
return(c(n, xt[1], NA, rep(xt[1], 5), length(x) - length(xt)))
}
else {
return(c(n, mean(xt), sqrt(var(xt)), min(xt), quantile(xt,
c(0.25, 0.5, 0.75)), max(xt), length(x) - length(xt)))
}
}
Computing file changes ...