Learn R Programming

crawl (version 1.5)

expandPred: Expand a time indexed data set with additional prediction times

Description

Expands a covariate data frame (or vector) that has a separate time index by inserting prediction times and duplicating the covariate values for all prediction time between subsequent data times.

Usage

expandPred(x, Time = "Time", predTime, time.col = FALSE)

Arguments

x
Data to be expanded.
Time
Either a character naming the column which contains original time values, or a numeric vector of original times
predTime
prediction times to expand data
time.col
Logical value indicating whether to attach the new times to the expanded data

Value

  • data.frame expanded by predTime

Examples

Run this code
#library(crawl)
origTime <- c(1:10)
x <- cbind(rnorm(10), c(21:30))
predTime <- seq(1,10, by=0.25)
expandPred(x, Time=origTime, predTime, time.col=TRUE)

Run the code above in your browser using DataLab