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

-- 
View this message in context: 
http://www.nabble.com/How-to-read-plain-text-documents-into-a-vector--tp25867792p25870485.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.

Reply via email to