https://github.com/cran/fda
Tip revision: 81688cdc23ed9ea8cbcb73644d25b4f6911af409 authored by J. O. Ramsay on 03 October 2008, 00:00:00 UTC
version 2.0.5
version 2.0.5
Tip revision: 81688cd
subscript.R
"[.fd" <- function(fdobj, i=TRUE, j=TRUE, drop=FALSE) {
# select subsets of curves in a functional data object
coef <- fdobj$coefs
fdnames <- fdobj$fdnames
ndim <- length(dim(coef))
if(ndim == 2) {
coefselect <- coef[, i]
if(length(fdnames[[2]])>1){
fdnames[[2]] = fdnames[[2]][i]
}
} else {
coefselect <- coef[, i, j]
if(length(fdnames[[2]])>1){
fdnames[[2]] = fdnames[[2]][i]
}
if(length(fdnames[[3]])>1){
fdnames[[3]] = fdnames[[3]][j]
}
}
fd(coefselect, fdobj$basis, fdnames)
}