Nothing
#' Extract the number of observations
#'
#' This function extracts the number of observations in an object
#' of class \code{\link{pim.environment}}, or the number of observations
#' for which a \code{\link{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 \code{\link{length}}.
#'
#' @param object an object of the class \code{\link{pim.environment}} or \code{\link{pim.poset}}
#' @param ... arguments passed to other methods.
#'
#' @return In case the function is called on a \code{pim.environment}
#' or a \code{pim.poset} object,
#' an integer with the number of (foreseen) observations. If the
#' pim.environment is empty, it returns \code{0}.
#'
#' In all other cases, it returns the output of either \code{\link{nrow}}
#' or \code{\link{length}}.
#'
#' @include pim.environment-class.R
#' @export
#' @rdname nobs
setMethod("nobs",
signature="pim.environment",
function(object){
if(identical(object@nobs,integer(0))){
0
} else {
object@nobs
}
})
#' @rdname nobs
setMethod("nobs",
signature="pim.poset",
function(object){
object@nobs
})
#' @rdname nobs
setMethod("nobs",
signature="matrix",
function(object){
nrow(object)
})
#' @rdname nobs
setMethod("nobs",
signature="data.frame",
function(object){
nrow(object)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.