nobs: Extract the number of observations

Description Usage Arguments Details Value

Description

This function extracts the number of observations in an object of class pim.environment, or the number of observations for which a pim.poset is constructed. If applied to a matrix or data.frame, it returns the number of rows. For any other object it does the same as length.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S4 method for signature 'pim.environment'
nobs(object)

## S4 method for signature 'pim.poset'
nobs(object)

## S4 method for signature 'matrix'
nobs(object)

## S4 method for signature 'data.frame'
nobs(object)

Arguments

object

an object of the class pim.environment or pim.poset

Details

This package imports the generic nobs from the package stats4.

Value

In case the function is called on a pim.environment or a pim.poset object, an integer with the number of (foreseen) observations. If the pim.environment is empty, it returns 0.

In all other cases, it returns the output of either nrow (for matrices and data.frames) or length.


pim documentation built on March 26, 2020, 7:57 p.m.