nearestTime: Merge data frames based on the nearest datetime differences.

Description Usage Arguments Value

View source: R/mergeTime.R

Description

Takes two data frames each with time/date columns in date-time or date format (i.e., able to be compared using the function difftime), finds the rows of df2 that minimize the absolute value of the datetime for each of the rows in df1, and merges the corresponding rows of df2 into df1 for downstream processing.

Usage

1
nearestTime(df1, df2, timeCol1, timeCol2)

Arguments

df1

Data frame containing the dates for which the differences between the other data frame's date column should be minimized for each row.

df2

Data frame containing the dates which should be compared to, as well as other values that should be merged to df1 per minimized date time.

timeCol1

Character vector specifying the date/time column in df1.

timeCol2

Character vector specifying the date/time column in df2.

Value

A merged data frame that minimizes datetime differences.


bayesbio documentation built on May 2, 2019, 3:43 a.m.