nobs: Compute the Number of Non-missing Observations
Description
Compute the number of non-missing observations. Provides a 'default'
method to handle vectors, and a method for data frames.
Usage
nobs(object, ...)
## S3 method for class 'default':
nobs(object, ...)
## S3 method for class 'data.frame':
nobs(object, ...)
## S3 method for class 'lm':
nobs(object, ...)
Arguments
object
Target Object
...
Optional parameters (currently ignored)
Value
Either single numeric value (for vectors) or a vector of numeric
values (for data.frames) giving the number of non-missing values.
code
stats
Details
Calculate the number of observations in object.
For numeric vectors, this is simply the number of non-NA elements, as computed bysum(!is.na(object)).
For dataframe objects, the result is a vector containing the
number of non-NA elementes of each column.