Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

truncateTime

Function to truncate time in functional data


Description

Function to truncate time in functional data

Usage

truncateTime(funVar, time, newtime, data)

Arguments

funVar

names of functional variables that should be truncated

time

name of time variable

newtime

new time vector that should be used. Must be part of the old time-line.

data

list containing all the data

Value

A list with the data containing all variables of the original dataset with the variables of funVar truncated according to newtime.

Note

All variables that are not part if funVar, or time are simply copied into the new data list

Examples

if(require(fda)){
  dat <- fda::growth
  dat$hgtm <- t(dat$hgtm[,1:10])
  dat$hgtf <- t(dat$hgtf[,1:10])
  
  ## only use time-points 1:16 of variable age
  datTr <- truncateTime(funVar=c("hgtm","hgtf"), time="age", newtime=1:16, data=dat)
  
  
  par(mfrow=c(1,2))
  with(dat, funplot(age, hgtm, main="Original data"))
  with(datTr, funplot(age, hgtm, main="Yearly data"))
  par(mfrow=c(1,1))   
  
}

FDboost

Boosting Functional Regression Models

v1.0-0
GPL-2
Authors
Sarah Brockhaus [aut], David Ruegamer [aut, cre], Almond Stoecker [aut], Torsten Hothorn [ctb], with contributions by many others (see inst/CONTRIBUTIONS) [ctb]
Initial release
2020-08-31

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.