kenhorvath wrote:
>
>
>
> Dieter Menne wrote:
>>
>>
>> library(tm)
>> filenames = list.files(path=".",pattern="\\.txt")
>> docs = ""
>> for (filename in filenames){
>> docs = c(docs,paste(readLines(file(filename)),collapse="\n"))
>> }
>> docs
>> ## continue as in example
>> vs = VectorSource(docs)
>>
>>
>
> If in any way possible I would recommend to do the whole procedure via
> lists, not recursively.
>
> Ken
>
While I agree that the appending could be more efficiently be done by a list
as an intermediate, the
docs = c(doc," ljljljl")
construct is not recursive, even if not efficient.
Dieer
--
View this message in context:
http://www.nabble.com/How-to-read-plain-text-documents-into-a-vector--tp25867792p25887088.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.