Skip to content

space - time (geological time scale)

2 messages · John Ortiz, Edzer Pebesma

#
On 09/26/2011 02:19 PM, John Ortiz wrote:
I can only think of a trick, and not a really nice one. Convert your 
times such that they can be represented as integers, and then convert to 
one of the allowed time classes, and later on back to numeric. If you 
don't "round", (e.g. to Ka), you'll loose digits when transforming back:

 > as.numeric(as.yearqtr(1:10+.1))
  [1]  1  2  3  4  5  6  7  8  9 10
 > as.numeric(as.yearmon(1:10+.1))
  [1]  1.083333  2.083333  3.083333  4.083333  5.083333  6.083333  7.083333
  [8]  8.083333  9.083333 10.083333
# not so suitable:
 > as.numeric(as.POSIXct(1:10+.1,origin="1-1-1"))
  [1] -62135600399 -62135600398 -62135600397 -62135600396 -62135600395
  [6] -62135600394 -62135600393 -62135600392 -62135600391 -62135600390

Hth,