Re: [R] POSIX time conversion doesn't display digit

2009-08-30 Thread Uwe Ligges



R_help Help wrote:

Hi,

I have the following string that I converted to a POSIXct:


a - 2009-08-24 10:00:00.213
a.p - strptime(a,%Y-%m-%d %H:%M:%OS)
as.double(as.POSIXct(a.p))

[1] 1251122400

I can't seem to get the decimal fraction of .213 out by casting to
double or numeric. Is there anyway to make sure that POSIXct spits
that out? Thank you.


It is in the object, just rounded when printed to the console, see:

format(as.double(as.POSIXct(a.p)), digits=22)

Best,
Uwe Ligges





adschai

__
R-help@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@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.


Re: [R] POSIX time conversion doesn't display digit

2009-08-30 Thread Gabor Grothendieck
Try this:

 options(digits = 20)
 as.double(as.POSIXct(a.p))
[1] 1251122400.213


On Sat, Aug 29, 2009 at 11:37 PM, R_help Helprhelp...@gmail.com wrote:
 Hi,

 I have the following string that I converted to a POSIXct:

 a - 2009-08-24 10:00:00.213
 a.p - strptime(a,%Y-%m-%d %H:%M:%OS)
 as.double(as.POSIXct(a.p))
 [1] 1251122400

 I can't seem to get the decimal fraction of .213 out by casting to
 double or numeric. Is there anyway to make sure that POSIXct spits
 that out? Thank you.

 adschai

 __
 R-help@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@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] POSIX time conversion doesn't display digit

2009-08-29 Thread R_help Help
Hi,

I have the following string that I converted to a POSIXct:

 a - 2009-08-24 10:00:00.213
 a.p - strptime(a,%Y-%m-%d %H:%M:%OS)
 as.double(as.POSIXct(a.p))
[1] 1251122400

I can't seem to get the decimal fraction of .213 out by casting to
double or numeric. Is there anyway to make sure that POSIXct spits
that out? Thank you.

adschai

__
R-help@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.