title: user defined function for glm in r not working
body: <p>I want to execute logistic regression for each predictor seperately using glm. Total predictors are 50 and churn_flag is target variable and What I have done so far as:-</p>
  
  <pre><code>lapply(c('A1','A2','A3','A4',.................'A50'),
  
     univariate_logistic &lt;- function(var) {
  
       formula    &lt;- as.formula(paste('churn_flag ~ ', var))
       res.logist &lt;- glm(formula, data = split_train, family = binomial)
  
       summary(res.logist)
       })`
  </code></pre>
  
  <p>After running a function when I passed a variable name inside function as,</p>
  
  <pre><code>univariate_logisitic(A1)
  </code></pre>
  
  <p>it gives error as,</p>
  
  <pre><code>Error in univariate_logistic(A1) : 
  
  
  could not find function "univariate_logistic"
  </code></pre>