Re: [R] wildcard symbol or character

From: john.polo <jpolo_at_mail.usf.edu>
Date: Tue, 03 Jun 2008 13:17:01 -0400

Michael Dewey wrote:
>> 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
> Did you really use split()?
yes, i did. the output looked like this:  > split(rtt,RTT)
$`1E-.`
  [1] CW-W739 CW-W729 CW-W719 CW-W709 CW-W699 CW-W689B CW-W679 CW-W669
...
$`1W-.`
  [1] CW-W738 CW-W728 CW-W718 CW-W708 CW-W698 CW-W688 CW-W678 CW-W668 ...
> I suspect that
> ?strsplit
> might help you and you can follow the link to regular expressions or do
> ?regexp
> for enlightenment on the wonders of regular expressions.
>
> As another poster has mentioned you can of course use substr() in this
> case but regular expressions enable you to do far more.
i haven't tried any of other solution suggested in other posts yet. thanks for your reply.

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. Received on Tue 03 Jun 2008 - 19:32:15 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 Tue 03 Jun 2008 - 20:30:45 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