[R] Print occurrence / positions of words
smartpink111 at yahoo.com
Mon Apr 22 21:18:25 CEST 2013
May be this helps:
vec<- "this is a nice text with nice characters"
# vec2<-str_split(vec," ")[]
# 4 7
>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.
>As an example, if the text file has the string:
>"this is a nice text with nice characters"
>The output should be something like:
> 4 7
>A useful post which i came across here was http://r.789695.n4.nabble.com/Memory-usage-in-R-grows-considerably-while-calculating-word-frequencies-td4644053.html . However it doesnt include the positions of each words.
>A similar function which i found through the documentation i guess
it's the "str_locate", however i want to count "words" and not
>Any guidance of what packages / techniques to use on that, would be really appreciated
More information about the R-help