Subsetting a corpus based on content of textfile
<p>I'm using R and the tm package to do some text analysis. 
I'm trying to build a subset of a corpus based on whether a certain expression is found within the content of the individual text files. </p>

<p>I create a corpus with 20 textfiles (thank you lukeA for this example): </p>

<pre><code>reut21578 &lt;- system.file("texts", "crude", package = "tm")
corp &lt;- VCorpus(DirSource(reut21578), list(reader = readReut21578XMLasPlain))
</code></pre>

<p>I now would like to select only those textfiles that contain the string "price reduction" to create a subset-corpus. </p>

<p>Inspecting the first textfile of the document, I know that there is at least one textfile containing that string: </p>

<pre><code>writeLines(as.character(corp[1]))
</code></pre>

<p>How would I best go about doing this? </p>