Learn R Programming

splusTimeDate (version 2.5.8)

internal: Align Functions for Package Developers

Description

Time and number alignment functions for package developers.

Usage

.numalign(origpos, newpos, how, error.how, matchtol = 0)
.timealign(origpos, newpos, how, error.how, matchtol = 0)

Value

an object like pos.

Arguments

origpos

a vector of original position values.

newpos

a vector of new positions to align or interpolate it to.

how

specifies how to treat unmatched positions. Must be one of the following:

"NA"Insert a row of NA.
"drop"Drop that position entirely.
"nearest"Use the row with the nearest position.
"before"Use the data from the row whose position is just before the unmatched position.
"after"Use the data from the row whose position is just after the unmatched position.
"interp"Interpolate linearly between "before" and "after".

error.how

specifies available actions when an out of bounds error occurs. (Such an error can occur when how is "before", "after", or "interp"). Must be one of the following:

"NA"Insert a row of NA.
"drop"Drop that position entirely.
"nearest"Use the row with the nearest position.

matchtol

the tolerance for matching positions.

Examples

Run this code
.numalign(1:3, 2, how=NA, error=NA)
.timealign(5:7, 8, how=NA, error=NA)

Run the code above in your browser using DataLab