closestDatetime: closestDatetime

Description Usage Arguments Value Examples

View source: R/closestDatetime.R

Description

Function that finds the closest datetime_ within a vector of given datetimes. E.g. one has a point of a track at a given time and searches for the closest wind data.

Usage

1
closestDatetime(datetime_, datetimes)

Arguments

datetime_

Given time as POSIXct

datetimes

Vector of possible datetimes as POSIXct

Value

Closest datetime as POSIXct

Examples

1
2
3
4
5
6
d1 = as.POSIXct("2014-06-09 21:44:25 CEST")
dt = as.POSIXct( c("2014-06-08 23:00:00 CEST", "2014-06-09 05:00:00 CEST",
                   "2014-06-09 11:00:00 CEST", "2014-06-09 17:00:00 CEST",
                   "2014-06-09 23:00:00 CEST", "2014-06-10 05:00:00 CEST",
                   "2014-06-10 11:00:00 CEST", "2014-06-10 17:00:00 CEST") )
closestDatetime(datetime_ = d1, datetimes = dt)

mpio-be/windR documentation built on Feb. 2, 2020, 10:04 a.m.