Extract observations of functional data
This function extracts one or more observations and/or observations on
a part of the domain from a funData
, irregFunData
or
multiFunData
object.
extractObs( object, obs = seq_len(nObs(object)), argvals = funData::argvals(object) ) ## S4 method for signature 'funData' subset(x, obs = seq_len(nObs(x)), argvals = funData::argvals(x)) ## S4 method for signature 'multiFunData' subset(x, obs = seq_len(nObs(x)), argvals = funData::argvals(x)) ## S4 method for signature 'irregFunData' subset(x, obs = seq_len(nObs(x)), argvals = funData::argvals(x)) ## S4 method for signature 'funData,ANY,missing,missing' x[i, j, ..., drop = TRUE] ## S4 method for signature 'multiFunData,ANY,missing,missing' x[i, j, ..., drop = TRUE] ## S4 method for signature 'irregFunData,ANY,missing,missing' x[i = seq_len(nObs(x)), j, ..., drop = TRUE]
object |
An object of class |
obs |
A numeric vector, giving the indices of the observations to extract (default: all observations). |
argvals |
The part of the domain to be extracted (default: the
whole domain |
x |
An object of class |
i |
A numeric vector, giving the indices of the observations to
extract when using |
j, drop |
not used |
... |
Used to pass further arguments to |
In case of an irregFunData
object, some functions may not have
observation points in the given part of the domain. In this case, the
functions are removed from the extracted dataset and a warning is
thrown.
If only observations are to be extracted, the usual notation
object[1:3]
is equivalent to extractObs(object, obs =
1:3)
. This works only if the domain remains unchanged.
An object of class funData
, irregFunData
or
multiFunData
containing the desired observations.
[,funData,ANY,missing,missing-method
:
The function is currently implemented only for functional data with up to three-dimensional domains.
The function subset
is an alias for
extractObs
.
# Univariate - one-dimensional domain object1 <- funData(argvals = 1:5, X = rbind(1:5, 6:10)) extractObs(object1, obs = 1) extractObs(object1, argvals = 1:3) extractObs(object1, argvals = list(1:3)) # the same as the statement before # alias subset(object1, argvals = 1:3) # Univariate - two-dimensional domains object2 <- funData(argvals = list(1:5, 1:6), X = array(1:60, dim = c(2, 5, 6))) extractObs(object2, obs = 1) extractObs(object2, argvals = list(1:3, c(2,4,6))) # argvals must be supplied as list # Univariate - irregular irregObject <- irregFunData(argvals = list(1:5, 2:4), X = list(2:6, 3:5)) extractObs(irregObject, obs = 2) extractObs(irregObject, argvals = 1:3) extractObs(irregObject, argvals = c(1,5)) # throws a warning, as second function has no observations # Multivariate multiObject <- multiFunData(object1, object2) extractObs(multiObject, obs = 2) multiObject[2] # shorthand extractObs(multiObject, argvals = list(1:3, list(1:3, c(2,4,6)))) ### Shorthand via "[]" object1[1] object1[argvals = 1:3] object2[1] object2[argvals = list(1:3, c(2,4,6))] irregObject[2] irregObject[argvals = 1:3]
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.