How to filter documents in a tm corpus in R based on metadata?
<p>I am using the R tm package and I am trying to select certain documents by their index and their metadata:</p>

<pre><code>orbit_corpus&lt;-Corpus( tm_corpus, readerControl = list(reader=myReader))

meta(my_corpus[[1]])

author  : a8
origin  : Department 
heading : WhiB
id      : 1
year    : 2013
</code></pre>

<p>I would like to get find all documents that within the first hundred documents of my corpus that have been published in 2013.
This works to identify whether the metadata 'year' for document 1 are 2013.      </p>

<pre><code>meta(my_corpus[[1]],"year") == 2013
[1] TRUE
</code></pre>

<p>I need something that gives me the option to find among the first 100 all indexes, which  meet the criterion.
I would imagine something similar to this (but it does not work and unfortunately would probably also not generate a list of the documents).</p>

<pre><code>meta(orbit_corpus[[1:100]],"year") == 2013
Error in x$content[[i]] : recursive indexing failed at level 4
</code></pre>

<p>Many thanks for the help!</p>