R/nobs-methods.R

Defines functions `nobs.character` `nobs.factor` `nobs.data.frame` `nobs.matrix` `nobs.integer` `nobs.numeric` nobs

## nobs generic is defined only in R 2.13.0: define here for older R
if (getRversion() < "2.13.0")
    nobs <- function(object, ...) UseMethod("nobs")

## add some nobs() methods - need to be documented
`nobs.numeric` <- function(object, ...) {
    length(object)
}

`nobs.integer` <- function(object, ...) {
    nobs.numeric(object, ...)
}

`nobs.matrix` <- function(object, ...) {
    NROW(object)
}

`nobs.data.frame` <- function(object, ...) {
    NROW(object)
}

`nobs.factor` <- function(object, ...) {
    length(object)
}

`nobs.character` <- function(object, ...) {
    length(object)
}

Try the permute package in your browser

Any scripts or data that you put into this service are public.

permute documentation built on March 18, 2022, 7:36 p.m.