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

argvals

Extract and set slots from functional data objects


Description

These functions can be used to extract and set the slots of funData, irregFunData and multiFunData objects.

Usage

argvals(object)

getArgvals(object)

## S4 method for signature 'funData'
getArgvals(object)

## S4 method for signature 'multiFunData'
getArgvals(object)

## S4 method for signature 'irregFunData'
getArgvals(object)

X(object)

getX(object)

## S4 method for signature 'funData'
getX(object)

## S4 method for signature 'multiFunData'
getX(object)

## S4 method for signature 'irregFunData'
getX(object)

argvals(object) <- value

setArgvals(object, value)

## S4 method for signature 'funData'
setArgvals(object, value)

## S4 method for signature 'multiFunData'
setArgvals(object, value)

## S4 method for signature 'irregFunData'
setArgvals(object, value)

X(object) <- value

setX(object, value)

## S4 method for signature 'funData'
setX(object, value)

## S4 method for signature 'multiFunData'
setX(object, value)

## S4 method for signature 'irregFunData'
setX(object, value)

Arguments

object

An object of class funData, irregFunData or multiFunData.

value

New argvals or X. See Details.

Details

Objects of class funData or irregFunData have two slots, argvals (for the x-values) and X (for the y-values for each observation). Using the argvals (alias: getArgvals) and X (alias: getX) methods for the classes funData and irregFunData is equivalent to accessing the slots directly via object@argvals and object@X. Analogously, the argvals<- and X<- functions are equivalent to setting object@argvals to value or object@X to value, respectively. The new values must hence have the same structure as the original ones. As an exception, for an object of class funData the number of new X values may differ from the current (e.g. when adding new observations). In this case, the function throws a warning.

Objects of class multiFunData are lists of several funData objects. The functions argvals and X for multiFunData objects therefore return a list of the same length as object, where each list element corresponds to the argvals or X slot of the univariate element. The argvals<- and X<- functions for multiFunData objects must receive lists of the same length as object, where each list element corresponds to the new argvals or new X slot for the univariate elements.

Value

See Details.

Warning

The functions getArgvals / getX and setArgvals / setX from former package versions are deprecated. use argvals and X instead.

See Also

Examples

### Univariate
object <- funData(argvals = 1:5, X = rbind(1:5, 6:10))
object

# get-methods
argvals(object)
X(object)

# set-methods
argvals(object) <- 0:4
object 
## Not run: argvals(object) <- 1:4 # wrong length
X(object) <- rbind(0:4, 5:9)
## Not run: X(object) <- rbind(0:4, 5:9, 10:14) # warning: now 3 observations (was 2 before)
## Not run: X(object) <- rbind(1:4, 5:8) # wrong length

### Univariate (irregular)
irregObject <- irregFunData(argvals = list(1:5, 2:4), X = list(2:6, 3:5))
irregObject

# get-methods
argvals(irregObject)
X(irregObject)

# set-methods
argvals(irregObject) <- list(0:4, 1:3)
X(irregObject) <- list(12:16, 13:15)

### Multivariate
multiObject <- multiFunData(object, funData(argvals = 1:3, X = rbind(3:5, 6:8)))
multiObject

# get-methods
argvals(multiObject)
X(multiObject)

# set-methods (for special cases see univariate version)
argvals(multiObject) <- list(5:1, 3:1)
X(multiObject) <- list(rbind(5:1, 10:6), rbind(5:3, 8:6))

funData

An S4 Class for Functional Data

v1.3-5
GPL-2
Authors
Clara Happ-Kurz [aut, cre]
Initial release
2020-04-23

We don't support your browser anymore

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