nearestTimeIndex {RTCA}R Documentation

GET INDEX FOR NEAREST TIME

Description

Get index for the nearest time point to the given one. Called internally in many time-point related functions.

Usage

nearestTimeIndex(rtca, time)

Arguments

rtca

An object of RTCA

time

numeric, a time point

Details

The function finds the time point with minimum absolute difference to the given time and returns its index.

Value

An integer, the index of the nearest time point

Author(s)

Jitao David Zhang jitao_david.zhang@roche.com

See Also

timepoints to return all time points of an RTCA object.

Examples

require(RTCA)
  
ofile <- system.file("/extdata/testOutput.csv", package="RTCA")
x <- parseRTCA(ofile)

x
xIndex <- nearestTimeIndex(x, 25)
timepoints(x)[xIndex]

[Package RTCA version 1.42.0 Index]