fd2funData: Convert an fd object to funData

Description Usage Arguments Value Warning See Also Examples

View source: R/coerce.R

Description

This function converts an object of class fd (from package fda) to an object of class funData. It heavily builds on the function eval.fd from the fda package. The fd representation assumes a basis representation for the observed functions and therefore implicitly smoothes the data. In funData objects, the data is saved in 'raw' format.

Usage

1

Arguments

fdobj

An fd object

argvals

A vector or a list of length one, containing a vector with argument values at which the functions in fdobj should be evaluated.

...

Other parameters passed to eval.fd.

Value

An object of class funData.

Warning

Time names in fdobj$fdnames$time are not preserved.

See Also

funData, fd, eval.fd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Install / load package fda before running the examples
library("fda")

# from Data2fd help
daybasis <- create.fourier.basis(c(0, 365), nbasis=65)
# fd object of daily temperatures
tempfd <- Data2fd(argvals = day.5, y = CanadianWeather$dailyAv[,,"Temperature.C"], daybasis)
# convert to funData
tempFun <- fd2funData(tempfd, argvals = day.5)

# plot to compare
par(mfrow = c(1,2))
plot(tempfd, main = "fd object")
plot(tempFun, main = "funData object") 

Example output

Attaching package: 'funData'

The following object is masked from 'package:stats':

    integrate

Loading required package: splines
Loading required package: Matrix

Attaching package: 'fda'

The following object is masked from 'package:graphics':

    matplot

[1] "done"

funData documentation built on Oct. 17, 2021, 5:06 p.m.