title: R : How to resolve invalid subscript type 'list'
body: <p>Origianl dataframe is</p>
  
  <pre><code>id status name ...
  1  0      V
  1  0      S
  1  1      V
  1  0      V
  2  0      V
  2  1      V
  2  1      S
  3  0      V
  3  1      S
  4  1      S
  4  0      V
  4  1      V
  </code></pre>
  
  <p>Out of this, I expect to fetch id 2 and 3 as in their subset I have a "0-V" combination followed by "1-S"</p>
  
  <p>I have split that into a list of dataframes and I want to fetch the id's for some particular conditions on those dataframes but I get the error </p>
  
  <pre><code>invalid subscript type 'list'
  </code></pre>
  
  <p>The structure is like follows </p>
  
  <pre><code>"1"
  id status name ...
  1  0      V
  1  0      S
  1  1      V
  1  0      V
  
  "2"
  id status name ...
  2  0      V
  2  1      V
  2  1      S
  ...
  </code></pre>
  
  <p>Now I need to find a condition such that I get the id where there is a record of 0 status and name 'V' followed by a 1 status and name "S" like for id 2.</p>
  
  <p>For doing so, I'm trying to write a function for sapply but I'm not able to subscript the data as I'm assuming it to be</p>
  
  <p>Here is the code</p>
  
  <pre><code>q4 &lt;- result1[,c("id", "name", "date", "status")]
  
  lstQ &lt;- split(q4, result1$id)
  
  
  f3 &lt;- function(g) {
    g[g$status == 0 &amp; g$name == "V",]
  } 
  
   e &lt;- as.data.frame(names(lstQ)[sapply(lstQ, f3)])
  </code></pre>
  
  <p>How can I subscript my dataframe to get the desired check condition?</p>