Re: [R] wildcard symbol or character

From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>
Date: Mon, 02 Jun 2008 22:13:59 -0400

Dear John,

Assuming that your information is in the list x, does

substr(x,1,2)

work for you?

HTH, Jorge

On Mon, Jun 2, 2008 at 10:07 PM, john.polo <jpolo_at_mail.usf.edu> wrote:

> hello all,
>
> i want to split a list into smaller lists. the list looks like this:
> CW-W730 CW-W720 CW-W710 CW-W700 CW-W690 CW-W680 CW-W670 CW-W660
> CE-W997 CE-W987 CE-W977 CE-W967 CE-W956 CE-W944 CE-W934 CE-W924
> 7W-W760 7W-W750 7W-96 7W-941 7W-932 7W-923 7W-914 7W-905
> 7E-W565 7E-W555 7E-W545 7E-W535 7E-W525 7E-906 7E-850 7E-840 ...
>
>
> i want the smaller lists to be based on the first two characters, like CW
> or 7E. i tried split() where the f variable =
> c("1E-*","1W-*","2E-*","2W-*","5E-*","5W-*","7E-*","7W-*","CE-*","CW-*"),
> but * doesn't work as a wildcard as i had hoped. can someone tell me the
> appropriate wildcard character/symbol to use, please?
>
> john
>
> ______________________________________________
> 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.
>

        [[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. Received on Tue 03 Jun 2008 - 02:50:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 Jun 2008 - 04:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive