title: Writing a loop in R for regression replacing independent variable for robustness check
body: <p>I want to run a simple logit regression in R, where my dependent variable is whether a firm charges a positive price or not, and the key independent variable is number of competitors within an x mile radius of the firm.  To operationalize the competition variable, I am looking at 1, 5, 10 and 50 miles radius.</p>
  <p>I am not sure how to write the loop though, and the <code>Error in eval(predvars, data, env) : object 'radius_i' not found </code> when I run the loop below.</p>
  <pre><code>circle_radius = list(&quot;1&quot;, &quot;5&quot;, &quot;10&quot;, &quot;15&quot;, &quot;50&quot;)
  
  for (i in seq_along(circle_radius)){
      my_logit_4_r[i]  &lt;-  glm(price_b1 ~   radius_i , 
                              data=data1,
                              family = binomial(link='logit'))
      summary(my_logit_4_r[i])
     }    
  </code></pre>
  <p>So I am not sure how to specify the loop, as I do not want to use brute force and write the 4 regressions separately.  Would appreciate help on what error I am making.</p>