library(MachineShop) info <- modelinfo() types <- c("binary" = "b", "factor" = "f", "matrix" = "m", "numeric" = "n", "ordered" = "o", "Surv" = "S") x <- lapply(names(info), function(modelname) { c(modelname, ifelse(names(types) %in% info[[modelname]]$response_types, types, NA)) }) df <- as.data.frame(do.call(rbind, x), stringsAsFactors = FALSE) names(df) <- c("Function", names(types)) rdoc_names <- sapply(df$Function, function(name) { switch(name, "CoxStepAICModel" = "CoxModel", "GLMStepAICModel" = "GLMModel", "PDAModel" = "FDAModel", "SurvRegStepAICModel" = "SurvRegModel", "SVMANOVAModel" = "SVMModel", "SVMBesselModel" = "SVMModel", "SVMLaplaceModel" = "SVMModel", "SVMLinearModel" = "SVMModel", "SVMPolyModel" = "SVMModel", "SVMRadialModel" = "SVMModel", "SVMSplineModel" = "SVMModel", "SVMTanhModel" = "SVMModel", "XGBDARTModel" = "XGBModel", "XGBLinearModel" = "XGBModel", "XGBTreeModel" = "XGBModel", name ) }) toString2 <- function(x) toString(na.omit(x)) df_classes <- data.frame( Function = rdoc_url(df$Function, rdoc_names), Label = sapply(info, getElement, name = "label"), Categorical = apply(df[c("binary", "factor", "ordered")], 1, toString2), Continuous = apply(df[c("matrix", "numeric")], 1, toString2), Survival = apply(df["Surv"], 1, toString2) ) names(df_classes)[3:5] <- paste0(names(df_classes)[3:5], footnote_marker_number(1:3)) kable(df_classes, caption = "Package-supplied model constructor functions and supported response variable types.", align = c("l", "l", "c", "c", "c"), row.names = FALSE, escape = FALSE) %>% kable_styling(c("striped", "condensed"), full_width = FALSE, position = "center") %>% add_header_above(c(" " = 1, " " = 1, "Response Variable Types" = 3)) %>% footnote(number = c("b = binary factor, f = factor, o = ordered factor", "m = matrix, n = numeric", "S = Surv"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.