Hi,

Am I missing something in using regexps in R?
Below, 'egrep' means invokation of the command from the shell 
prompt.

# I have
> as.character(block.dist.vals)
[1] "1e+06" "2e+06" "5e+06"
# that I wish to convert to:  "1" "2" "5"

# OK (R and egrep)
> sub( "e.+06", "", as.character(block.dist.vals) )
[1] "1" "2" "5"
# OK (R), egrep will *not* match pattern
> sub( "e\\+06", "", as.character(block.dist.vals) )
[1] "1" "2" "5"

# egrep will match pattern; R will not.
> sub( "e\+06", "", as.character(block.dist.vals) )
[1] "1e+06" "2e+06" "5e+06"

As-far-as I can tell the last attempt should have worked, too.
Could someone explain to me why it doesn't?

I have R 1.7.0 on RedHat 9.

Thanks in advance,
        Itay Furman

=========================================================================
                                Fred Hutchinson Cancer Research Center
email: [EMAIL PROTECTED]                1100 Fairview Avenue N., Mailstop D4-100
phone: +1 (206) 667 5921        P.O. Box 19024
fax:   +1 (206) 667 2917        Seattle, WA  98109-1024

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to