Re: [R] How to create a legend without plot, and to use scientific notation for axes label ?

From: Hans-Joerg Bibiko <bibiko_at_eva.mpg.de>
Date: Thu, 10 Apr 2008 12:57:59 +0200

On 10 Apr 2008, at 12:33, Stanley Ng wrote:
> How can I use formatC to convert 6000000 to 6e5 and not 6e+05 ?
>
>> formatC(600000)
> [1] "6e+05"
>> formatC(600000, format="e", digit=0)
> [1] "6e+05"

Try this:

gsub("([eE])(\\+?)(\\-?)0+", "\\1\\3", formatC(600000, format="e", digit=0))

--Hans



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 Thu 10 Apr 2008 - 11:18:50 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 10 Apr 2008 - 12:30:27 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