Learn R Programming

metRology (version 0.9-28-1)

rbind.ilab: Combine 'ilab' objects

Description

Functions to combine ilab objects.

Usage

rbind(..., deparse.level = 1)
# S3 method for default
rbind(..., deparse.level = 1)
# S3 method for ilab
rbind(..., deparse.level = 1)

# S3 method for ilab c(..., recursive=FALSE)

cbind(..., deparse.level = 1) # S3 method for default cbind(..., deparse.level = 1) # S3 method for ilab cbind(..., deparse.level = 1)

Arguments

For rbind and c, objects of class ‘ilab’ to be combined. For cbind, one 'ilab' object and vectors, scalars or data frames to be appended to the 'ilab' object's $data element. See Details.

deparse.level

integer controlling the construction of labels. Passed to rbind.data.frame or base::cbind.

recursive

logical, controlling recursion in lists. Included solely for consistency with base::c; no effect in c.ilab.

ilab

object of class ‘ilab’.

Value

An object of class ‘ilab’. The title for the returned object is the title for the first ilab object in the list.

For the cbind method, the returned object will have additional columns in the $data element, and the title will be unchanged.

Warning

Because of the unusual method dispatch behaviour of base::cbind and base::rbind, which use the data frame method if any objects in '...' are data frames, metRology masks the base package functions in order to guarantee correct dispatch when data frames are included in '...'. No adverse effects are currently known, but please report any to the package maintainer. Calling base::cbind directly will provide a work-around if necessary.

Details

The generic and default cbind and rbind functions defined by metRology use the first object in '...' to decide which method to apply. This differs from the behaviour of these functions in the base package, which dispatch based on inspection of all objects in '...' (see rbind in the base package for details). Control is, however, passed to the base package functions if an ilab object is not first in the list.

The rbind method for class 'ilab' combines objects by applying rbind to the $data elements in turn and then concatenating the $distrib and $distrib.pars elements using the default c method.

Combination of the $data elements follows the rules of rbind.data.frame; in particular, names must match, but need not be in the same order and the return value column classes will be coerced to match the first if necessary.

c.ilab simply passes the objects to rbind.ilab, using the default value for deparse.level. recursive is ignored. An error is returned if any objects in '...' are not of class ‘ilab’.

The cbind method for ‘ilab’ objects combines objects of class ‘ilab’ with atomic objects or data frames by applying base::cbind to $data in the (single) supplied ilab object and the items listed in '...'. base::cbind will extend scalars, vectors or columns in data frames to length nrow(ilab$data) if their length is an integer fraction of nrow(ilab$data). Unlike base::cbind, cbind.ilab does not permit vectors or data frames longer than nrow(ilab$data) and will return an error in such cases. cbind.ilab will also return an error if any objects in '...' are not one of atomic, data frame or class ‘ilab’, if more than one ‘ilab’ object is supplied or if none are.

References

None, yet.

See Also

base package functions cbind, c.

Examples

Run this code
# NOT RUN {
data(Pb)
il1<-construct.ilab(org=Pb$lab, x=Pb$value, measurand="Pb", item="none", 
                u=Pb$u, k=Pb$k, U=Pb$U, title=c("CCQM K30", "Lead in wine"),
                method=Pb$method)

rbind(il1, il1)

# }

Run the code above in your browser using DataLab