Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Further to my comment, how about if you combine your plain text documents in <code>R</code> before creating the corpus? For example, if <code>1.txt</code>, <code>2.txt</code> and <code>3.txt</code> are plain text files, you can read them into <code>R</code> like so</p> <pre><code>a &lt;- readLines(file("C:/Users/X/Desktop/1.txt")) b &lt;- readLines(file("C:/Users/X/Desktop/2.txt")) c &lt;- readLines(file("C:/Users/X/Desktop/3.txt")) </code></pre> <p>and then you could combine them, similar to your example above</p> <pre><code>abc &lt;- c(a, b, c) </code></pre> <p>That will stack the documents up in order and preserve line-by-line format in a single data object, as you request. However, if you then make this into a corpus with </p> <pre><code>abc.corpus &lt;- Corpus(VectorSource(abc)) # not what you want </code></pre> <p>then you'll get a corpus with as many documents as lines, which doesn't sound like what you want. Instead what you need to do is combine the text objects like this </p> <pre><code>abc.paste &lt;- paste(a,b,c, collapse=' ') # this is what you want </code></pre> <p>so that the resulting <code>abc.paste</code> object is a single line. Then when you make a corpus using </p> <pre><code>abc.corpus &lt;- Corpus(VectorSource(abc.paste)) </code></pre> <p>the result will be <code>A corpus with 1 text document</code> which you can then analyse with functions in the <code>tm</code> package.</p> <p>It should be straightforward to extend this into a function to efficiently concatenate your 7000+ plain text documents and then make a corpus from the resulting data object. Does that get you any closer to what you want to do?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload