Raw Message
Message-ID: <55369168.3020302@yahoo.com.ar>
Date: 2015-04-21T18:05:28Z
From: Luciano La Sala
Subject: Question on funcion and npar
In-Reply-To: <alpine.DEB.2.00.1002111656090.10326@paninaro.stat-math.wu-wien.ac.at>
Dear everyone,
The following function, taken from Quick-R, gets measures of central
tendency and spread for a numeric vector x.
I can't figure out what the argument npar means in each instance.
Any tips will be most appreciated.
mysummary <- function(x, npar=TRUE, print=TRUE) {
if (!npar) {
center <- mean(x); spread <- sd(x)
} else {
center <- median(x); spread <- mad(x)
}
if (print & !npar) {
cat("Mean=", center, "\n", "SD=", spread, "\n")
} else if (print & npar) {
cat("Median=", center, "\n", "MAD=", spread, "\n")
}
result <- list(center=center,spread=spread)
return(result)
}
--
Luciano F. La Sala
Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET)
C?tedra de Epidemiolog?a
Departamento de Biolog?a, Bioqu?mica y Farmacia
Universidad Nacional del Sur
San Juan 670
Bah?a Blanca (8000)
Argentina