R/length.R

Defines functions getLength

# ----------------------
# Author: Andreas Alfons
#         KU Leuven
# ----------------------

## sample control
setMethod("length", "VirtualSampleControl", function(x) getK(x))

## sample setup
setMethod("length", "SampleSetup", function(x) length(getIndices(x)))

## contamination control
setMethod("length", "VirtualContControl", function(x) length(getEpsilon(x)))

## NA control
setMethod("length", "VirtualNAControl", function(x) getLength(getNArate(x)))

getLength <- function(x) {
    if(is(x, "numeric")) length(x) 
    else if(is(x, "matrix")) nrow(x)
    else NA  # other classes
}

Try the simFrame package in your browser

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

simFrame documentation built on Oct. 14, 2021, 5:24 p.m.