Re: [R] Calculating distance between words in string

2015-11-11 Thread Jim Lemon
Perhaps what you are seeking is a sparse distance matrix. "How far is each word from every other matching word" sentence<-"How far is each word from every other matching word" words<-tolower(unlist(strsplit(sentence," "))) nwords<-length(words) wdm<-matrix(NA,nrow=nwords,ncol=nwords) for(word in

Re: [R] Calculating distance between words in string

2015-11-11 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Karl > Subject: [R] Calculating distance between words in string > > .. given a specific keyword, I need to assign labels to the other words > based on the distance (number of words) to this keyword. > >

Re: [R] Calculating distance between words in string

2015-11-06 Thread David Winsemius
> On Nov 6, 2015, at 3:28 AM, Karl wrote: > > Hi All, > > Using R for text processing is quite new to me, while I have found a lot of > useful functions and I'm beginning to learn regex, I need help with the > following task. How do I calculate the distance between words? > > That is, given a