Open some-guy1 opened 5 years ago
I am thinking the gsub(ag, nms[i], strg)
code could be removed and the line before the gsub replaced with something like:
strg <- paste(paste("(", paste(nms, sep = "",
collapse = "+"), ")^2", sep = ""), "+", paste("I(",
nms, "^2)", sep = "", collapse = "+"))
This is my variable list:
I then send to expand.formula:
expand.formula(y~quad(.),varNames= names(df) )
This outputs the wrong set of variables:
This is because of the
gsub(ag, nms[i], strg)
within the quad/cubic functions is replacing too many variables in the formula string.