Message-ID: <5D81B808-7B75-4688-8B57-2F43579B2458@me.com>
Date: 2015-04-21T18:13:13Z
From: Marc Schwartz
Subject: Question on funcion and npar
In-Reply-To: <55369168.3020302@yahoo.com.ar>
> On Apr 21, 2015, at 1:05 PM, Luciano La Sala <lucianolasala at yahoo.com.ar> wrote:
>
> 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)
> }
>
Presumably ?nonparametric?, since median()/mad() is used in lieu of mean()/sd(), if npar = TRUE.
Regards,
Marc Schwartz