near_join: Left join based on the closest value

View source: R/near_join.R

near_joinR Documentation

Left join based on the closest value

Description

Add rows from y to x based on the closest numeric value in a single common column. This function is used to join based on matches of values or datetimes within a numeric tolerance.

Usage

near_join(x, y, by = "datetime", tolerance)

Arguments

x

Data frame of to index against

y

Data frame that will be joined to x based on closest value in x.

by

The column name to join by. There can only be one column. If x and y have different column names, use the format by = c("a" = "b"). Default is "datetime".

tolerance

The maximum numeric difference between values in x and y to establish a match. If the difference exceeds the tolerance NA is returned for that row in x. The default tolerance is Inf which will return the closest value or position regardless of the absolute difference.


DEQrmichie/heatsourcetools documentation built on Jan. 25, 2025, 2:31 p.m.