# NOT RUN {
sapply(warpbreaks, .MFclass) # "numeric" plus 2 x "factor"
sapply(iris, .MFclass) # 4 x "numeric" plus "factor"
mf <- model.frame(Sepal.Width ~ Species, iris)
mc <- model.frame(Sepal.Width ~ Sepal.Length, iris)
.checkMFClasses("numeric", mc) # nothing else
.checkMFClasses(c("numeric", "factor"), mf)
## simple .getXlevels() cases :
(xl <- .getXlevels(terms(mf), mf)) # a list with one entry " $ Species" with 3 levels:
stopifnot(exprs = {
identical(xl$Species, levels(iris$Species))
identical(.getXlevels(terms(mc), mc), xl[0]) # a empty named list, as no factors
is.null(.getXlevels(terms(x~x), list(x=1)))
})
# }
Run the code above in your browser using DataLab