Skip to content

Instantly share code, notes, and snippets.

@jmg
Last active February 22, 2018 22:15
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 jmg/86656fab907708d1af6cdf7e285ad7ae to your computer and use it in GitHub Desktop.
Save jmg/86656fab907708d1af6cdf7e285ad7ae to your computer and use it in GitHub Desktop.
R build form from paras
buildFormula <- function(dataset, terms_array) {
for (i in 1:length(terms_array))
assign(paste("fact", i, sep=""), L(dataset, terms_array[i]))
factors = array()
for (i in 1:length(terms_array))
factors[i] <- paste("fact", i, sep="")
form = as.formula(paste("dataset~", paste(factors, collapse="+")))
return(form)
}
#example call
form <- buildFormula(strain, c(1,6,12))
## Fit
fit <- dynrq(form, tau = tau)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment