Skip to content
Prev 154945 / 398506 Next

test if all predictors in a glm object are factors

on 09/03/2008 04:56 PM Michael Friendly wrote:
Michael,

How about something like this:

is.discrete.glm <- function(model) {
  all(attr(terms(model), "dataClasses")[-1] == "factor")
}


Essentially, take the output of terms(model), check the 'dataClasses'
attribute, except for the first element, which is the DV.
[1] TRUE


HTH,

Marc Schwartz