[R] Any simple way to subset a vector of strings that do contain a particular substring ?

Moshe Olshansky m_olshansky at yahoo.com
Thu Jun 19 07:48:29 CEST 2008


strings[-grep("ba",strings)]


--- On Thu, 19/6/08, Daren Tan <daren76 at hotmail.com> wrote:

> From: Daren Tan <daren76 at hotmail.com>
> Subject: [R] Any simple way to subset a vector of strings that do contain a particular substring ?
> To: r-help at stat.math.ethz.ch
> Received: Thursday, 19 June, 2008, 3:18 PM
> For example, 
>  
> strings <- c("aaaa",
> "bbbb","ccba"). 
>  
> How to get "aaaa", "bbbb" that do not
> contain "ba" ?
> _________________________________________________________________
> 
> 
> 	[[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