[R] separate the sentence after finding a particular word

Rui Barradas ruipbarradas at sapo.pt
Wed Jun 13 16:51:20 CEST 2012


Hello,

Try

x <- scan(what="character", text="my name name name is micky")
rle(x)
paste(rle(x)$values, collapse=" ")

Hope this helps,

Rui Barradas

Em 13-06-2012 13:06, raishilpa escreveu:
> hello,
> I want to know ..how we can separate the sentence after finding a particular
> word...
> for example
>
> I love to watch movies  of Hollywood but should not be romantic...I want to
> join you school but due to bad financial condition I cant..
>
> I want output in following format
> I love to watch movies  of Hollywood
> should not be romantic
> I want to join you school
> due to bad financial condition I cant
>
> So whenever  this but is coming in the sentence of a paragraph I want the
> sentence before but and after but in two different lines...
>
> Please help me....
>
> Thanks in Advance
>
> Shilpa Rai
> Msc ( IIT Bombay)
>
> --
> View this message in context: http://r.789695.n4.nabble.com/separate-the-sentence-after-finding-a-particular-word-tp4633240.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list