Skip to content

Instantly share code, notes, and snippets.

@briandk
Created September 17, 2014 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briandk/bec4f1faa030f37ffb09 to your computer and use it in GitHub Desktop.
Save briandk/bec4f1faa030f37ffb09 to your computer and use it in GitHub Desktop.
Helping Cynthia with her problem
getFormula <- function(checkboxOutput, variablesThatMustAppearInModel) {
formula <- "testScores ~"
variables1 <- paste(variablesThatMustAppearInModel, collapse = " + ")
variables2 <- paste(checkboxOutput, collapse = " + ")
fullCall <- paste(variables1,
variables2,
collapse = " + ",
sep = " + ")
return(paste(formula,
fullCall))
}
library(ggplot2)
model = do.call(what = lm,
args = list(formula = getFormula(),
data = mpg))
x = c("red", "blue", "green")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment