title: multiple ifelse with and and or conditions in R
body: <p>I have a dataset and I want to create a multiple ifelse statement. 
  I want to find out if this person/id lived in the big city (being london or paris) in the years 2011 and 2012. Any suggestions how I can get this with multiple ifelse?</p>
  
  <pre><code> id&lt;-  c(1,1,2,2,3)
   location &lt;- c('london', 'paris', 'london', 'kathmanadu','newyork')
   year&lt;- c(2011, 2010, 2012, 2011, 2010)
   df&lt;- data.frame(location, year)
   df$bigcity&lt;- ifelse(df$location=='london'| df$location=='paris' &amp; 
   df$year==2011| df$year==2012, 1, 0)
  </code></pre>