[R] gsub
Rui Barradas
ruipbarradas at sapo.pt
Thu Jun 14 15:34:06 CEST 2012
Hello,
Try
t1 <- "(Ithis) I(test)"
t2 <- "(Ithis) test"
t3 <- sub("I\\((.+)\\)", "\\1", t1)
t2 == t3 #[1] TRUE
If there are more than one occurences, use 'gsub'.
Hope this helps,
Rui Barradas
Em 14-06-2012 12:03, nalluri pratap escreveu:
>
> Hi,
>
> I have a string t1="(Ithis) I(test)". I need to get t2="(Ithis) test".
>
> Can someone look into this. ?I have tried using gsub("I[^)]","",t1) , but didn't get the required result.
>
> Thanks,
> Pratap
> [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> 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