[R] Best way to do temporal joins in R?

Jonathan Greenberg greenberg at ucdavis.edu
Mon Mar 16 19:35:58 CET 2009


I've been playing with zoo a bit, and it seems ok except it doesn't 
support non-unique time stamps when performing joins.  I have two 
databases which contain a dataframe of a Date object (with the time, not 
just MM/DD/YY), e.g.:

DB 1:
UniqueID,Date1,Data 1,Data 2

DB 2:
Date2, Station, Data 3

We'll say Station can contain three values: A,B and C

DB 1 may have some repeat times, and DB 2 definitely has them -- 
although each Date, Station combo is unique (this DB contains weather 
data collected on the half-hour or fifteen minute interval at a set of 
stations).  I'd like DB2's station and Data3 to be joined with DB1 based 
on the nearest time stamp (interpolating Data3 or not).

Ideally, I'd like a fused database such that I get for each uniqueID in DB1:

UniqueID,Date,Data1,Data2,Station,Data3

Thoughts?  Hints?

--j



-- 

Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Cell: 415-794-5043
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307




More information about the R-help mailing list