# R/quadset.R In fda: Functional Data Analysis

```quadset <- function(nquad=5, basisobj=NULL, breaks, returnMatrix=FALSE){

##
##
{
warning("nquad must be at least 5;  increase to this minimum.")
}
else {
warning("nquad must be an odd integer;  increased to enforce this.")
}
}
}
##
## 2.  check basisobj
##
if(!is.null(basisobj) && !is.basis(basisobj))
stop('basisobj is not a basis object.')
##
## 3.  check breaks
##
if(missing(breaks) || length(breaks) == 0) {
if(is.null(basisobj) || !is.basis(basisobj))
stop("Either 'breaks' or 'basisobj' must be provided.")
#
type <- basisobj\$type
if(type != 'bspline')
stop(
"'breaks' not supplied and 'basisobj' is not a spline basis.")
#
rangeval <- basisobj\$rangeval
params   <- basisobj\$params
knots    <- c(rangeval[1], params, rangeval[2])
breaks   <- unique(knots)
}
##
##
nbreaks = length(breaks);
#
db <- diff(breaks)
nbreaks1 <- nbreaks-1
# 4.1.  First create quadpts as a matrix
# 4.2.  Now convert quadpts matrix to the desired vector
# 4.3.  Similarly first create quadwts as a matrix
# 4.4.  Now convert quadwts matrix to the desired vector

#
values <- vector("list", 2)
for( ivalue in 1:2){
values[[ivalue]] <- eval.basis(quadpts, basisobj, ivalue-1, returnMatrix)
}
basisobj\$values <- values
basisobj
}
```

## Try the fda package in your browser

Any scripts or data that you put into this service are public.

fda documentation built on May 2, 2019, 5:12 p.m.