Compute the number of non-missing observations. Provides a 'default' method to handle vectors, and a method for data frames.
1 2 3 4 5 6 7
Optional parameters (currently ignored)
Calculate the number of observations in
For numeric vectors, this is simply the number of non-NA elements, as computed by
For dataframe objects, the result is a vector containing the number of non-NA elementes of each column.
nobs.lm functions defined in gtools are
simply aliases for the functions in the base R
provided for backwards compatibility.
Either single numeric value (for vectors) or a vector of numeric values (for data.frames) giving the number of non-missing values.
The base R package
stats now provides a S3 dispatch function for
nobs, and methods for for objects of classes "lm", "glm",
"nls" and "logLik", as well as a default method.
Since they provided a subset of the the functionality, the base
method dispatch (
nobs) function and method for "lm" objects
nobs.lm) are, as of
gdata version 2.10.1, simply
aliases for the equivalent functions in the base R
gdata's default method (
vectors and hands any other data/object types to
Gregory R. Warnes email@example.com
1 2 3 4 5 6 7 8 9 10 11 12 13