R/fdParcheck.R

Defines functions fdParcheck

Documented in fdParcheck

fdParcheck = function(fdParobj, ncurve=NULL) {
  #  Last modified 16 November 2021 by Jim Ramsay
  if (inherits(fdParobj, "basisfd") && is.null(ncurve)) 
    stop("First argument is basisfd object and second argument is missing.")
  if (!inherits(fdParobj, "fdPar")) {
    if (inherits(fdParobj, "fd")) {
        fdParobj <- fdPar(fdParobj)
    }
    if (inherits(fdParobj, "basisfd")) {
      nbasis   <- fdParobj$nbasis
      fdParobj <- fdPar(fd(matrix(0,nbasis,ncurve),fdParobj))
    } else {
        stop(paste("'fdParobj' is not a functional parameter object,",
               "not a functional data object, and",
               "not a basis object."))
    }
  }
  return(fdParobj)
  
}

Try the fda package in your browser

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

fda documentation built on Sept. 30, 2024, 9:19 a.m.