Learn R Programming

splusTimeDate (version 1.5.0-72)

groupVecExtValid: groupVec Extended Class Validation

Description

Checks the validity for classes that extend the groupVec class.

Usage

groupVecExtValid(object, names, classes, checkrest = FALSE)

Arguments

object
the object to be validated.
names
a character vector containing correct column names.
classes
a character vector containing correct column classes.
checkrest
a logical value. If TRUE (the default), checks that the non-groupVec slots have length

Value

  • returns TRUE if object is valid; otherwise returns a descriptive string.

Details

This function checks to see whether an object is a valid groupVec extending object. These are the steps in this process:
  1. ThegroupVecValidfunction is called to verify thatobjectis a validgroupVecobject.
  2. The column names in thenamesslot ofobjectare checked against thenamesargument, and the column classes in theclassesslot ofobjectare checked against theclassesargument.
  3. Ifcheckrestistrue, thegroupVecNonVecfunction is called to check whether the non-groupVecslots ofobjecthavelength<= 1.<="" li="">

See Also

groupVecValid, groupVecNonVec, groupVec class

Examples

Run this code
setClass("myclass", representation(a = "numeric"), contains="groupVec",
   prototype=prototype(names="nums", classes="numeric",
      columns=list(numeric(0)), a=numeric(0)))
setValidity("myclass",  
   function(object) groupVecExtValid(object, "nums", "numeric", FALSE)) 
obj <- new("myclass") 
obj@a <- 1:5 
validObject(obj) 
groupVecExtValid(obj, "nums", "numeric", TRUE)

Run the code above in your browser using DataLab