From 3627bec17edf0e5915f6afdc69a5345576bc8ddc Mon Sep 17 00:00:00 2001 From: unknown <ldecicco@IGSARMEWLTLAD2.gs.doi.net> Date: Thu, 7 Aug 2014 16:54:52 -0500 Subject: [PATCH] Updated mergeReport to use R's internal merge function. Can handle samples taken on the same day. --- R/mergeReport.r | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/R/mergeReport.r b/R/mergeReport.r index 0cf0af3e..321647d5 100644 --- a/R/mergeReport.r +++ b/R/mergeReport.r @@ -18,12 +18,15 @@ mergeReport<-function(localDaily = Daily, localSample = Sample, interactive=TRUE if (interactive){ dataOverview(localDaily, localSample) } - julFirst<-localDaily$Julian[1] - sampleDate<-as.Date(localSample$Date) - sampleJulian<-as.numeric(julian(sampleDate,origin=as.Date("1850-01-01"))) - sampleIndex <- sampleJulian-julFirst+1 - Q <- localDaily$Q[sampleIndex] - LogQ<-log(Q) - newSample<-data.frame(localSample,Q,LogQ) + + newSample <- merge(Daily[,c("Date","Q","LogQ")],Sample,by = "Date",all.y = TRUE) + +# julFirst<-localDaily$Julian[1] +# sampleDate<-as.Date(localSample$Date) +# sampleJulian<-as.numeric(julian(sampleDate,origin=as.Date("1850-01-01"))) +# sampleIndex <- sampleJulian-julFirst+1 +# Q <- localDaily$Q[sampleIndex] +# LogQ<-log(Q) +# newSample<-data.frame(localSample,Q,LogQ) return(newSample) } -- GitLab