Learn R Programming

splusTimeDate (version 2.5.8)

groupVecExtValid: groupVec Extended Class Validation

Description

Checks the validity for classes that extend the groupVec class.

Usage

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

Value

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

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 <= 1.

Details

This function checks to see whether an object is a valid groupVec extending object. These are the steps in this process:

  1. The groupVecValid function is called to verify that object is a valid groupVec object.

  2. The column names in the names slot of object are checked against the names argument, and the column classes in the classes slot of object are checked against the classes argument.

  3. If checkrest is true, the groupVecNonVec function is called to check whether the non-groupVec slots of object have length <= 1.

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