groupVec
Extended Class Validation
groupVec
class.
groupVecExtValid(object, names, classes, checkrest=F)
groupVec
slots have
length
<= 1 if
T
.
T
if
object
is valid, and a descriptive string
if it is not.
This function checks to see whether object is a valid
groupVec
extending object. There are several steps in this process. First,
the
groupVecValid
function is called to verify that
object
is a valid
groupVec
object.
Next the column names in the
.Data.names
slot of
object
are
checked against the
names
argument, and the column classes in
the
.Data.classes
slot of
object
are checked against the
classes
argument.
Finally, if
checkrest
is true, the
groupVecNonVec
function is called to
check whether the non-
groupVec
slots of
object
all have
length
<= 1.
setClass("myclass", representation("groupVec", a = "numeric")) setValidity("myclass", function(object) groupVecExtValid(object, "nums", "numeric", F)) setClassPrototype("myclass", list(.Data.names="nums", .Data.classes="numeric", .Data=list(numeric(0)))) obj <- new("myclass") obj@a <- 1:5 validObject(obj) groupVecExtValid(obj, "nums", "numeric", T)