title: How to apply a chunk of code (not only a single function) to all columns in dataset
body: <p>I would like to apply this chunk of code to each column in a dataset. I can run all columns individually, but it is tedious to make repeated code for 75 different columns and change all of the names in the code to match each column name. Is there a way that I can run all columns individually at once without making code for each column individually?</p>
  
  <pre><code>max.Width =lmer(mergeCowpeaTEST$max.Width ~ (1|Genotype) + (1|Year) + (1|Genotype:Year) + (1|Rep:Year), data=mergeCowpeaTEST,na.action = na.omit)
  model.a_max.Width &lt;-lmer(max.Width~ (1|Genotype) + (1|Year) + (1|Genotype:Year) + (1|Rep:Year),     data=mergeCowpeaTEST)
  alt.est.a_max.Width &lt;- influence(model.a_max.Width, obs=TRUE)
  cooks&lt;-cooks.distance(alt.est.a_max.Width)
  plot(alt.est.a_max.Width, which="cook", sort=FALSE,main="cook's distance plot of max.Width")
  which(residuals(max.Width)&gt;0.10)
  which(residuals(max.Width)&lt;(-0.10))
  boxplot(residuals(max.Width))
  myboxplot&lt;-boxplot(residuals(max.Width))
  myboxplot$out
  hist(residuals(max.Width))
  qqnorm(residuals(max.Width))
  pdf("Widiv_max.Width_residual_graphs.pdf",height=8,width=10)
  plot(fitted(max.Width),residuals(max.Width), xlab="Predicted values", ylab="Residuals",     main="Residual Plot of widiv max.Width")
  abline(h=0, col="red")
  hist(resid(max.Width),main="histogram of max.Width residuals")
  qqnorm(residuals(max.Width), main="Residuals Q-Q Plot");qqline(resid(max.Width))
  qqnorm(ranef(max.Width)$Genotype$"(Intercept)", main="Genotypes Q-Q Plot");     qqline(ranef(max.Width)$Genotype$"(Intercept)")
  qqnorm(ranef(max.Width)$"Genotype:Year"$"(Intercept)", main="Genotype by Year Q-Q Plot");     qqline(ranef(max.Width)$"Genotype:Year"$"(Intercept)")
  plot(alt.est.a_max.Width, which="cook", sort=FALSE,main="cook's distance plot of max.Width")
  dev.off()
  </code></pre>