[R] Scientific Notation

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Sep 26 22:12:14 CEST 2007


On Wed, 26 Sep 2007, Francisco J. Zagmutt wrote:

> I believe the argument to format is "scientific" i.e.
> axis(2, at=at, labels=format(at, scientific=FALSE))

Yes, but abbreviations of argument names are allowed.

Here setting a small positive value of options(scipen) (e.g. 2) gives 
floating-point notation as in

> at <- c(0.00005, 0.0005)
> options(scipen=2)
> as.character(at)
[1] "0.00005" "0.0005"
> axis(2, at=at, labels=as.character(at))

would do the job (and in many similar cases).

>
> Best regards,
>
> Francisco
>
> Duncan Murdoch wrote:
>> On 9/26/2007 11:24 AM, Jacques Wagnor wrote:
>>> Dear List:
>>>
>>> Below is how I specify an axis:
>>>
>>> axis(2, at=c(0.00005, 0.0005))
>>>
>>> R displays the numbers in scientific notation.  What
>>> argument/parameter should I use to tell R to display the numbers as
>>> specified rather than in scientific notation?
>>
>> Something like
>>
>> axis(2, at=c(0.00005, 0.0005), labels=c("0.00005", "0.0005"))
>>
>> is a way to be 100% sure of what will be displayed, but in this
>> particular instance,
>>
>> at <- c(0.00005, 0.0005)
>> axis(2, at=at, labels=format(at, sci=FALSE))
>>
>> comes close, and there may be some other format spec that gets exactly
>> what you want.
>>
>> Duncan Murdoch
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list