[R] wildcard symbol or character
info at aghmed.fsnet.co.uk
Tue Jun 3 12:52:41 CEST 2008
At 03:07 03/06/2008, john.polo wrote:
>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
>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 =
>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()?
I suspect that
might help you and you can follow the link to regular expressions or do
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.
More information about the R-help