1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
% $Id: nobs.Rd,v 1.5 2002/09/23 13:59:30 warnes Exp $
%
% $Log: nobs.Rd,v $
% Revision 1.5 2002/09/23 13:59:30 warnes
% - Modified all files to include CVS Id and Log tags.
%
% Revision 1.4 2002/03/26 19:29:15 warneg
%
% Updated to add ... parameter to function calls.
%
% Revision 1.3 2002/02/20 21:31:08 warneg
%
% Noted that specialized methods exist.
%
% Revision 1.2 2002/02/20 21:29:34 warneg
%
% Incorrectly had contents of nobs.R here instead of help text. Corrected.
%
%
\name{nobs}
\alias{nobs}
\alias{nobs.default}
\alias{nobs.data.frame}
\alias{nobs.lm}
%- Also NEED an `\alias' for EACH other topic documented here.
\title{ Compute the Number of Non-missing Observations }
\description{
Compute the number of non-missing observations. Special methods exist for
data frames, and lm objects.
}
\usage{
nobs(x, ...)
\method{nobs}{default}(x, ...)
\method{nobs}{data.frame}(x, ...)
\method{nobs}{lm}(x, ...)
}
\arguments{
\item{x}{ Target Object }
\item{\dots}{ Optional parameters (currently ignored)}
}
\details{
In the simplest case, this is really just wrapper code for
\code{sum(!is.na(x))}.
}
\value{
A single numeric value or a vector of values (for data.frames) giving
the number of non-missing values.
}
\author{ Gregory R. Warnes \email{gregory\_r\_warnes\@groton.pfizer.com} }
\seealso{ \code{\link{is.na}}, \code{\link{length}} }
\examples{
x <- c(1,2,3,5,NA,6,7,1,NA )
length(x)
nobs(x)
df <- data.frame(x=rnorm(100), y=rnorm(100))
df[1,1] <- NA
df[1,2] <- NA
df[2,1] <- NA
nobs(df)
}
\keyword{attribute}
|