space - time (geological time scale)
On 09/26/2011 02:19 PM, John Ortiz wrote:
Dear all, I have a large dataset of fossil record of pollen. I'm interested in study of the relation spatial and temporal of this dataset. For each record I have four variables: location (X,Y), age and abundance. I'm exploring the new packages "space-time". Because I want to interpolate the abundance of a particular specie with krigeST function. My question is related with the time format. because to set a ST-class object, the time must to be an object of class xts, and the time in my dataset is not representing with calendar dates, my data set is in the geological time scale (Million of years ago, "Ma") Something like that: age_Ma <- c(14.52, 17.21, 23.12, 15,6) ## dates in million of years ago Any advice "trick" how transform a vector like this in an xts object?
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,
Regards, John
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de http://www.52north.org/geostatistics e.pebesma at wwu.de