truncateTime: Function to truncate time in functional data

Description Usage Arguments Value Note Examples

View source: R/utilityFunctions.R

Description

Function to truncate time in functional data

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

  ## Not run: 
  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))
  
## End(Not run)
}


FDboost documentation built on May 19, 2017, 9:54 p.m.
Search within the FDboost package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.