[R] How to specify multiple regular expressions for pattern argument

Tyler Rinker tyler_rinker at hotmail.com
Fri May 11 20:31:02 CEST 2012



I'm curious about the 'real' answer myself but this would work:



ls(pattern='^d')[ls(pattern='^d') %in% ls(pattern='[[:digit:]]$')]


Cheers,Tyler Rinker

----------------------------------------
> Date: Fri, 11 May 2012 13:18:59 -0500
> From: jun.shen.ut at gmail.com
> To: r-help at stat.math.ethz.ch
> Subject: [R] How to specify multiple regular expressions for pattern argument
>
> Dear list,
>
> I want to show all the objects starting with "d" and ending with a digit.
> How do I specify these conditions in the pattern argument
>
> I can do one condition but not two
>
> ls(pattern='^d')
> ls(pattern='[[:digit:]]$')
>
> are working.
>
> But,
>
> ls(pattern='^d'&'[[:digit:]]$') is not working.
>
> Appreciate any comment.
>
> Jun Shen
>
> [[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