title: Error using lapply to perform regression: variable lengths differ (found for 'x')
body: <p>I'm trying to use <code>lapply</code> to perform the same multiple logistic regression equation on 68 different variables stored in the vector <code>fsdata_dict1</code>. When I try to run the below code, I get the following error: <code>Error in model.frame.default(formula = binge_dr ~ x + Age_in_Yrs + Race +  :  variable lengths differ (found for 'x') </code>. No NAs are present in the data, and running str() on the data show all variables have the same number of observations. All variables to my knowledge are defined in the dataset, so I don't believe naming conflicts are the issue.</p>
  <p>Code:</p>
  <pre><code>glm_func &lt;- function(x){
   return(glm(binge_dr ~ x + Age_in_Yrs +  Race + SSAGA_Income + SSAGA_Educ, family = binomial, data = fdata_fs, na.action = na.pass))
  }
  
  lapply(fsdata_dict1, glm_func)
  </code></pre>