mapIdxToTime {DIAlignR}R Documentation

Establishes mapping from index to time

Description

Takes a time vector and index vector of same length. This function create a new time vector given indices specified in idx. For NA indices it uses last index to fill time value. For NA appearing at the start of idx, it uses next index to get time value.

Usage

mapIdxToTime(timeVec, idx)

Arguments

timeVec

A numeric vector

idx

An integer vector

Value

A mutated time vector

Author(s)

Shubham Gupta, shubh.gupta@mail.utoronto.ca

ORCID: 0000-0003-3500-8152

License: (c) Author (2019) + GPL-3 Date: 2019-12-13

Examples

timeVec <- c(1.3,5.6,7.8)
idx <- c(NA, NA, 1L, 2L, NA, NA, 3L, NA)
mapIdxToTime(timeVec, idx) # c(1.3, 1.3, 1.3, 5.6, 5.6, 5.6, 7.8, 7.8)


[Package DIAlignR version 0.99.12 Index]