R/fit.smooth.R

Defines functions fit.smooth

Documented in fit.smooth

#' Fit curve with spline
#'
#' @param y
#' @param x
#' @param r the x to predict from
#' @param para
#'
#' @return
#' @export
#'
#' @examples
fit.smooth <-
    function(y, x = seq_along(y), r = x, para = NULL) {
        # VER 3.3.1
        smooth.y <- NULL
        try({
            smooth.y <- smooth.spline(x, y)$y
        }, silent = T)
        if (is.null(smooth.y)) {
            cat(sprintf('Fit.smooth Failed'))
            return(NULL)
        }
        #         if (!area.output)
        return(smooth.y)
        #         area <- finiteIntegrate(x = x, y = smooth.y, r = x)
        #         return(area)
    }
yanxianUCSB/yxhelper documentation built on April 20, 2020, 4:09 p.m.