Running examples in ‘polyreg-Ex.R’ failed
The error most likely occurred in:

> ### Name: getPoly
> ### Title: Get polynomial terms
> ### Aliases: getPoly polyMatrix
> 
> ### ** Examples
> 
> N <- 125
> rawdata <- data.frame(x1 = rnorm(N), 
+                       x2 = rnorm(N),
+                       group = sample(letters[1:5], N, replace=TRUE),
+                       z = sample(c("treatment", "control"), N, replace=TRUE),
+                       result = sample(c("win", "lose", "tie"), N, replace=TRUE))
> head(rawdata)
          x1          x2 group         z result
1 -0.6264538  0.71266631     c   control    tie
2  0.1836433 -0.07356440     a treatment   lose
3 -0.8356286 -0.03763417     e treatment   lose
4  1.5952808 -0.68166048     c treatment   lose
5  0.3295078 -0.32427027     e treatment    tie
6 -0.8204684  0.06016044     d   control   lose
> 
> P <- length(levels(rawdata$group)) - 1 + 
+      length(levels(rawdata$z)) - 1 + 
+      length(levels(rawdata$result)) - 1 + 
+      sum(unlist(lapply(rawdata, is.numeric)))
> 
> # quadratic polynomial, includes interactions 
> # since maxInteractDeg defaults to deg
> X <- getPoly(rawdata, 2)$xdata 
> ncol(X) # 40
[1] 40
> 
> # cubic polynomial, no interactions
> X <- getPoly(rawdata, 3, 1)$xdata
> ncol(X) # 13
[1] 13
> 
> # cubic polynomial, interactions
> X <- getPoly(rawdata, 3, 2)$xdata
> ncol(X) # 58
[1] 58
> 
> # cubic polynomial, interactions
> X <- getPoly(rawdata, 3)$xdata
> ncol(X) # 101
[1] 101
> 
> # making final column the response variable, y
> # results in TRUE (fewer columns)
> ncol(getPoly(Xy=rawdata, deg=2)$xdata) < ncol(getPoly(rawdata, 2)$xdata)
[1] TRUE
> 
> # preparing polynomial matrices for crossvalidation
> # getPoly() returns a polyMatrix() object containing XtestFormula
> # which should be used to ensure factors are handled correctly out-of-sample
> Xtrain <- getPoly(rawdata[1:100,],2)
> Xtest <- getPoly(rawdata[101:125,], 2, modelFormula = Xtrain$XtestFormula)
>     
> # additional spot checks
> stopifnot(ncol(getPoly(rawdata, 1, 1)$xdata) == P)
Error: ncol(getPoly(rawdata, 1, 1)$xdata) == P is not TRUE
Execution halted