File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -53,13 +53,16 @@ dummyCode <- function(df, vars) {
53
53
# ' result$randPars
54
54
# ' head(result$X)
55
55
recodeData <- function (data , pars , randPars ) {
56
+ data <- as.data.frame(data ) # tibbles break things
57
+ factorLevels <- getFactorLevels(data , pars ) # need to store for predicting
56
58
data <- orderedFactorsToChars(data ) # ordered factors cause weird names
57
59
formula <- stats :: as.formula(paste0(" ~ " , paste(pars , collapse = " + " )))
58
60
X <- getDesignMatrix(formula , data )
59
61
return (list (
60
62
formula = formula ,
61
63
X = X ,
62
64
pars = colnames(X ),
65
+ factorLevels = factorLevels ,
63
66
randPars = recodeRandPars(data , pars , randPars )
64
67
))
65
68
}
Original file line number Diff line number Diff line change @@ -50,12 +50,12 @@ getModelInputs <- function(
50
50
# Get the design matrix, recoding parameters that are categorical
51
51
# or have interactions
52
52
data <- as.data.frame(data ) # tibbles break things
53
- factorLevels <- getFactorLevels(data , pars ) # need to store for predicting
54
53
recoded <- recodeData(data , pars , randPars )
55
54
formula <- recoded $ formula
56
55
X <- recoded $ X
57
56
pars <- recoded $ pars
58
57
randPars <- recoded $ randPars
58
+ factorLevels <- recoded $ factorLevels
59
59
scalePar <- defineScalePar(data , inputs , modelSpace )
60
60
outcome <- as.matrix(data [outcome ])
61
61
You can’t perform that action at this time.
0 commit comments