> >I have tried some different packages in order to build a R program > which will take as input a text file, produce a list of the > words inside that file. Each word should have a vector with > all the places that this word exist in the file.
How about txt <- paste(rep("this is a nice text with nice characters", 3), "But this is not", collapse=" ") library(stringr) txt.vec <-str_split(txt, "[^[:alnum:]_]+")[[1]] #vector of all the words in their original sequence tapply(1:length(txt.vec), txt.vec, c) #Returns a list of vectors of locations of each word, sorted alphabetically S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ 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.