[R] Help in R code

deepak aggarwal talk4deepak at gmail.com
Tue Mar 1 13:30:04 CET 2016

Hi ,

Seeking your help in coding following requirement in R.

Vector 1 has sentences for ex. vector 1="he is a nice human being","he is
smart and fast in his work"

vector 2 has keywords found in each sentence seperated by comma
for  ex. vector2 for vector 1 =nice,being
vector 2 for vector 1 =smart,work

I want output to be vector 3 which will show 2 words before and after where
match is found

vector 1                                       vector2        vector 3
he is a nice human being              nice,being        is a nice
human,human being
he is smart and fast in his work   smart,work        he is smart,in his work

in all i want vector 3 to how 2 words before and aftr to each word of
vector 2 from vector 1.

really appriciate your quick help on this.

Thanks & Regards

	[[alternative HTML version deleted]]

More information about the R-help mailing list