funData2fd: Convert a funData object to fd

Description Usage Arguments Value Warning See Also Examples

View source: R/coerce.R

Description

This function converts an object of class funData to an object of class fd (from package fda). It heavily builds on the function Data2fd 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
funData2fd(object, ...)

Arguments

object

A funData object

...

Other parameters passed to Data2fd.

Value

An object of class fd.

Warning

This function works only for funData objects on one-dimensional domains.

See Also

funData, fd, Data2fd, fd2funData

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)
# funData object with temperature
tempFun <- funData(day.5, t(CanadianWeather$dailyAv[, , "Temperature.C"]))
# convert to fd
tempfd <- funData2fd(tempFun, daybasis)

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

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.