#' Create Model Matrix for Predictions
#'
#' @param m model
#' @param newdata dataset at which predictions should be made
#' @return model.matrix
create_mm = function(m, newdata) {
# create model matrix
x_vars = delete.response(m$terms)
mf = model.frame(x_vars,
newdata,
xlev = m$xlevels)
if (!is.null(cl <- attr(x_vars, "dataClasses")))
.checkMFClasses(cl, m)
X = model.matrix(x_vars,
mf,
contrasts.arg = m$contrasts)
return(X)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.