title: R Conditional Regression with Multiple Conditions
body: <p>I am trying to run a regression in R based on two conditions.  My data has binary variables for both year and another classification.  I can get the regression to run properly while only using 1 condition:</p>
  <pre><code># now time for the millions of OLS
  # format: OLSABCD where ABCD are binary for the values of MSA/UA and years
  # A = 1 if MSA, 0 if UA
  # B = 1 if 2010
  # C = 1 if 2000
  # D = 1 if 1990
  
  OLS1000&lt;-summary(lm(lnrank ~ lnpop, data = subset(df, msa==1)))
  OLS1000
  </code></pre>
  <p>However I cannot figure out how to get both the MSA/UA classification to work with the year variables as well.  I have tried:</p>
  <pre><code>OLS1100&lt;-summary(lm(lnrank ~ lnpop, data = subset(df, msa==1, df$2010==1)))
  OLS1100
  </code></pre>
  <p>But it returns the error:</p>
  <blockquote>
  <p>Error: unexpected numeric constant in &quot;OLS1100&lt;-summary(lm(lnrank ~ lnpop,<br />
  data = subset(df, msa==1, df$2010&quot;</p>
  </blockquote>
  <p>How can I get the program to run utilizing both conditions?</p>
  <p>Thank you again!</p>