From simon.urbanek at r-project.org  Thu Feb 14 23:59:53 2008
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Thu, 14 Feb 2008 17:59:53 -0500
Subject: [Rd] number formsat
In-Reply-To: <15470234.post@talk.nabble.com>
References: <15470234.post@talk.nabble.com>
Message-ID: <4F69D69D-CF6F-43D9-82D1-30C6322F7E03@r-project.org>

Hill0093,

On Feb 14, 2008, at 5:43 PM, hill0093 wrote:

> PROBLEM ONE
> In my way of using R in print and plots,
> R severely ignores formatting requests for numbers.
> E.g.,
>> n1=2008021323595999
>> n1
> [1] 2.008021e+15
>> print(n1,digits=16)
> [1] 2008021323595999
>> print(n1,digits=18)
> [1] 2008021323595999
>> print(n1,digits=15)
> [1] 2008021323595999

You are not requesting specific formatting, you are requesting  
*significant digits* hence the above is as expected. For output  
formatting, see ?sprintf and ?formatC.


> The e+15 form for similar numbers also  appears in the tic mark  
> labels in plots,  but with yet other counts of significant digits.
> PROBLEM TWO
> I need to use a function that I could write, since I have done it in  
> several other languages, to convert my calendar times of various   
> lengths into linear time as I read the data. Then I need to use an  
> inverse function to  convert the linear time for the tic mark labels  
> of plots of the data, and for printouts.
> Where do I look to learn how to do this in R?
>

Time types in R are linear, try using them (see ?DateTimeClasses and ? 
as.POSIXct).

Please post help requests to R-help in the future.

Thanks,
Simon



[Rd] number formsat
Simon Urbanek