title: R boxcox not working
body: <pre><code>data1 &lt;- read.csv("~/Desktop/Group_22.csv")
  
  View(data1)
  
  E_var &lt;- regmatches(names(data1), regexpr("(E[0-9])+", names(data1)))  
  G_var &lt;- regmatches(names(data1), regexpr("(G[0-9]*)+", names(data1))) 
  
  (E_vs_G  &lt;- paste0(c(gsub(" ", "*", outer(E_var, G_var, paste))), collapse = "+"))
  (G_eff_1 &lt;- paste("I(", G_var, ")", collapse="+"))
  (G_eff_2 &lt;- paste("I(", apply( combn(G_var, 2), 2, paste, collapse="*"), ")", collapse="+"))
  (G_eff_3 &lt;- paste("I(", apply( combn(G_var, 3), 2, paste, collapse="*"), ")", collapse="+"))
  (E_eff  &lt;- paste0("I(", E_var,"^2", ")", collapse = "+"))
  
  (formula &lt;- paste( "I(log(Y)) ~" , paste(c(E_eff, G_eff_1, G_eff_2, G_eff_3, E_vs_G), collapse = "+")))
  
  M &lt;- lm(formula, data=data1)
  summary(M)
  
  anova(M)
  
  install.packages('MASS')
  
  library(MASS)
  
  boxcox(M)
  
  Error: object of type 'closure' is not subsettable 
  </code></pre>
  
  <p>the code runs properly except when it gets to boxcox(M) it gives me that error. what am i doing wrong?</p>