title: Logistic Regression Error in r
body: <p>I'm creating a model with several thousand variables, all of which have a majority of values equal to NA. I am able to successfully run logistic regression on some variables but not others. </p>
  
  <p>Here's my code to input the large amount of vars:</p>
  
  <pre><code>model_vars &lt;- names(dataset[100:4000])
  vars&lt;- paste("DP ~ ", paste(model_vars, collapse= " + "))  
  </code></pre>
  
  <p>This formats it with the dependant variable and each Independant variable having a "+" between. I then run this through the glm function:</p>
  
  <pre><code>glm(vars, data = training, family = binomial)
  </code></pre>
  
  <p>Here is the error I get when certain variables are included:</p>
  
  <pre><code>Error in family$linkfun(mustart) : 
  Argument mu must be a nonempty numeric vector
  </code></pre>
  
  <p>I cannot figure out why this is occuring and why the regression works for certain variables and not others. I can't see any trend in the variables that cause the error. Could someone clarify why this error shows up?</p>