[R] How to read plain text documents into a vector?

Dieter Menne dieter.menne at menne-biomed.de
Tue Oct 13 08:43:12 CEST 2009




Richard Liu wrote:
> 
> I'm new to R.  I'm working with the text mining package tm.  I have
> several plain text documents in a directory, and I would like to read all
> the files with extension .txt in that directory into a vector, one text
> document per vector element.  That is, v[1] would be the first document,
> v[2] the second, etc.
> 
> I know how to read the documents into a tm Corpus, but that's not what I
> want to do.  I would think that this kind of operation should be
> elementary and the first step in any text mining.
> 

Reading in a non-structured file is not that common in R, so tm provides
special methods. There is a vignette tm.pdf coming with tm that explains it
on the first page.

Dieter


-- 
View this message in context: http://www.nabble.com/How-to-read-plain-text-documents-into-a-vector--tp25867792p25867914.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list