EquallySpacedObs {HYPEtools}R Documentation

Create an equally spaced time series from irregular observations

Description

EquallySpacedObs creates equally spaced time series with missing observations from a data frame with irregular observations.

Usage

EquallySpacedObs(x, sort.data = TRUE, timestep, ts.col = 1)

Arguments

x

A data.frame, with a date-time column in POSIXt or Date format, and one or several columns with observed variables.

sort.data

Logical, if TRUE, x will be sorted by date-time.

timestep

Character string keyword, giving the target time step length. Either "day" or "hour".

ts.col

Integer, column index of datetime column.

Details

EquallySpacedObs will preserve additional attributes present in x. If datetime column is of class Date, there may occur problems with daylight saving time shifts. To avoid problems, use class POSIXct and set time zone to "UTC".

Value

EquallySpacedObs returns a dataframe.

Examples

te <- data.frame(date = as.POSIXct(c("2000-01-01", "2000-02-01"), tz = "gmt"), obs = c(1, 2))
EquallySpacedObs(x = te, timestep = "day")


[Package HYPEtools version 1.6.2 Index]