find_nearest | R Documentation |
This function finds the nearest y to every x. Y's may be duplicated.
find_nearest(
x,
y,
direction = c("both", "ascending", "descending"),
returnIndex = FALSE
)
getlower(x, y, upper = FALSE)
x |
first value |
y |
second value |
direction |
default = both, ascending for only y matches before x and descending for only y matches after x. |
returnIndex |
should an index of the mathced y values be returned instead of the matched list. |
upper |
upper value? |
a list of length 2 with a y matched to every x, note if direction =
'ascending' or 'descending', NAs will be returned for x values with no y
values before or after, respectively. OR an index of matched y values if
returnIndex = TRUE
.
indexes of y for each x
getlower()
: function for finding lower(upper) value
This function borrowed heavily from this stack exchange post: https://stats.stackexchange.com/questions/161379/quickly-finding-nearest-time-observation
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.