title: In R, extract rows based on strings in different columns
body: <p>Sorry if the solution to my problem is already out there, and I overlooked it. There are a lot of similar topics which all helped me understand the basics of what I'm trying to do, but did not quite solve my exact problem. </p>
  
  <p>I have a data frame df: </p>
  
  <pre><code>&gt; type = c("A","A","A","A","A","A","B","B","B","B","B","B")
  &gt; place = c("x","y","z","x","y","z","x","y","z","x","y","z")
  &gt; value = c(1:12)
  &gt; 
  &gt; df=data.frame(type,place,value)
  &gt; df
     type place value
  1     A     x     1
  2     A     y     2
  3     A     z     3
  4     A     x     4
  5     A     y     5
  6     A     z     6
  7     B     x     7
  8     B     y     8
  9     B     z     9
  10    B     x    10
  11    B     y    11
  12    B     z    12
  &gt; 
  </code></pre>
  
  <p>(my real data has 3 different values in type and 10 in place, if that makes a difference)</p>
  
  <p>I want to extract rows based on the strings in columns m and n. 
  E.g. I want to extract all rows that contain A in type and x and z in place, or all rows with A and B in type and y in place.</p>
  
  <p>This works perfectly with subset, but I want to run my scripts on different combinations of extracted rows, and adjusting the subset command every time isn't very effective. </p>
  
  <p>I thought of using a vector containing as elements what to get from type and place, respectively. </p>
  
  <p>I tried:</p>
  
  <pre><code>v=c("A","x","z")
  df.extract &lt;- df[df$type&amp;df$place %in% v]
  </code></pre>
  
  <p>but this returns an error. </p>
  
  <p>I'm a total beginner with R and programming, so please bear with me.</p>