R/RcppExports.R

Defines functions rcpp_wTSM movmean rcpp_SG rcpp_wSG sgmat_wB sgmat_B sgmat_S rcpp_season_filter f_goal_cpp cdoubleLog_Klos cdoubleLog_Gu cdoubleLog_Elmore cdoubleLog_Beck cdoubleLog_AG cdoubleLog_Zhang clogistic

Documented in movmean rcpp_season_filter rcpp_SG rcpp_wSG

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

clogistic <- function(par, t, pred) {
    invisible(.Call(`_phenofit_clogistic`, par, t, pred))
}

cdoubleLog_Zhang <- function(par, t, pred) {
    invisible(.Call(`_phenofit_cdoubleLog_Zhang`, par, t, pred))
}

cdoubleLog_AG <- function(par, t, pred) {
    invisible(.Call(`_phenofit_cdoubleLog_AG`, par, t, pred))
}

cdoubleLog_Beck <- function(par, t, pred) {
    invisible(.Call(`_phenofit_cdoubleLog_Beck`, par, t, pred))
}

cdoubleLog_Elmore <- function(par, t, pred) {
    invisible(.Call(`_phenofit_cdoubleLog_Elmore`, par, t, pred))
}

cdoubleLog_Gu <- function(par, t, pred) {
    invisible(.Call(`_phenofit_cdoubleLog_Gu`, par, t, pred))
}

cdoubleLog_Klos <- function(par, t, pred) {
    invisible(.Call(`_phenofit_cdoubleLog_Klos`, par, t, pred))
}

f_goal_cpp <- function(par, fun, y, t, ypred, w = NULL, ylu = NULL) {
    .Call(`_phenofit_f_goal_cpp`, par, fun, y, t, ypred, w, ylu)
}

#' season_filter
#' @param d Data.frame of growing season dividing info
#'
#' @inheritParams season
#' @keywords internal
#' @export
rcpp_season_filter <- function(d, rm_closed = TRUE, rtrough_max = 0.7, r_min = 0.02) {
    invisible(.Call(`_phenofit_rcpp_season_filter`, d, rm_closed, rtrough_max, r_min))
}

sgmat_S <- function(halfwin = 5L, d = 2L) {
    .Call(`_phenofit_sgmat_S`, halfwin, d)
}

sgmat_B <- function(S) {
    .Call(`_phenofit_sgmat_B`, S)
}

sgmat_wB <- function(S, w) {
    .Call(`_phenofit_sgmat_wB`, S, w)
}

#' Weighted Savitzky-Golay written in RcppArmadillo
#'
#' NA and Inf values in the yy has been ignored automatically.
#'
#' @param y colvec
#' @param w colvec of weight
#' @param halfwin halfwin of Savitzky-Golay
#' @param d polynomial of degree. When d = 1, it becomes moving average.
#'
#' @examples
#' y <- 1:15
#' w <- seq_along(y)/length(y)
#'
#' frame = 5
#' d = 2
#' s1 <- rcpp_wSG(y, frame, d, w)
#' s2 <- rcpp_SG(y, frame, d)
#' @export
rcpp_wSG <- function(y, halfwin = 1L, d = 1L, w = NULL) {
    .Call(`_phenofit_rcpp_wSG`, y, halfwin, d, w)
}

#' @rdname rcpp_wSG
#' @export
rcpp_SG <- function(y, halfwin = 1L, d = 1L) {
    .Call(`_phenofit_rcpp_SG`, y, halfwin, d)
}

#' movmean
#'
#' NA and Inf values in the yy will be ignored automatically.
#'
#' @param y A numeric vector.
#' @param halfwin Integer, half of moving window size
#' @param w Corresponding weights of yy, same long as yy.
#' @param SG_style If true, head and tail values will be in the style of SG
#' (more weights on the center point), else traditional moving mean style.
#' 
#' @examples
#' x <- 1:100
#' x[50] <- NA; x[80] <- Inf
#' s1 <- movmean(x, 2, SG_style = TRUE)
#' s2 <- movmean(x, 2, SG_style = FALSE)
#' @export
movmean <- function(y, halfwin = 1L, SG_style = FALSE, w = NULL) {
    .Call(`_phenofit_movmean`, y, halfwin, SG_style, w)
}

rcpp_wTSM <- function(y, yfit, w, iter, nptperyear, wfact) {
    .Call(`_phenofit_rcpp_wTSM`, y, yfit, w, iter, nptperyear, wfact)
}

Try the phenofit package in your browser

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

phenofit documentation built on Oct. 15, 2021, 5:09 p.m.