Skip to content
Prev 42183 / 63424 Next

delete.response leaves response in attribute dataClasses

My feeling that everyone would index dataClasses by name was
wrong.  I looked through the packages that used dataClasses
and saw code that would break if the first (response) entry
were omitted.  (I didn't check to see if passing the output
of delete.response to these functions would be appropriate.)
E.g.,
file: AICcmodavg/R/predictSE.mer.r
  ##matrix with info on factors
  fact.frame <- attr(attr(orig.frame, "terms"), "dataClasses")[-1]

  ##continue if factors
  if(any(fact.frame == "factor")) {
    id.factors <- which(fact.frame == "factor")
    fact.name <- names(fact.frame)[id.factors] #identify the rows for factors

Some packages create a dataClass attribute for a model.frame
(not its terms attribute) that does not have any names:
file: caper/R/macrocaic.R
   attr(mf, "dataClasses") <- rep("numeric", dim(termFactors)[2])
.checkMFClasses() does not throw an error for that, but it
doesn't do any real checking either.

Most users of dataClasses do pass it to .checkMFClasses() to
compare it with newdata and that doesn't care if you have extra
entries in dataClasses.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com