

kenhorvath wrote:
> 
> 
> 
> Paul Hiemstra wrote:
>> 
>> 
>> file_list = list.files("/where/are/the/files")
>> obj_list = lapply(file_list, FUN = yourfunction)
>> 
>> yourfunction is probably either read.table or some read function from 
>> the tm package. So obj_list will become a list of either data.frame's or 
>> tm objects.
>> 
>> 
> 
> The read function that most probably should be adequate is readLines(), so
> the command would read:
> 
> obj_list <- lapply(file_list,readLines)
> 
> To convert to a vector, do the following:
> 
> obj_list <- lapply(obj_list,paste,collapse=" ")
> obj_vec <- as.vector(obj_list)
> 
> Ken
> 
> 
Thanks to all for replies.  Just so that others who have the same problem
and find this thread aren't left without a status update, I summarize what
has happened thus far.  I have sent Dieter an email (offline) about the
vignette he mentions.  There are actually two vignettes.  Both have examples
of a vector of characters being made into a tm corpus, but neither shows how
to read documents on the file system into the vectors.  I tried the other
two suggestions, but paste seemed not to "glue" the separate lines together
into one character string.  Perhaps I missed something (collapse?).  Perhaps
I'll have another look.
-- 
View this message in context: http://www.nabble.com/How-to-read-plain-text-documents-into-a-vector--tp25867792p25885715.html
Sent from the R help mailing list archive at Nabble.com.

	[[alternative HTML version deleted]]


