[R] Faster way to combine data sets with different date ranges

From: t c <mudiver1200_at_yahoo.com>
Date: Fri, 07 Nov 2008 15:19:13 -0800 (PST)

I am trying to combine two data sets, one with daily values and one with weekly values.  SurveyData conatins environmental data collected on a daily basis.  sat.data contains satellite sea surface temperature that is an average of satellite measurements over a six day period.  I would like to combine the two files so that my output file has the daily dates from SurveyData and the weekly average from sat.data that corresponds to that day.  I have written a loop that does exactly what I want, but it takes a very long time.  Is there a faster way to do this?  What I have so far is below. Thanks,

#Compare dates
 for(i in 1:length(SurveyData$Date))
 for(j in 1:length(sat.data$Date.Start))
  sat.data$Date.Start[j]<=SurveyData$Date[i] &
  survey.data[i]<- sat.data$data[j]

#Create data frame with final data

#Write data to file

	[[alternative HTML version deleted]]


R-help_at_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. Received on Fri 07 Nov 2008 - 23:26:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 08 Nov 2008 - 17:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive