# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' @examples
#'
#' na_interp(c(1, NA, NA, 4))
#' na_interp(c(1, 2, 3, NA, NA, 6))
#' na_interp(c(1, NA, 3, NA, NA, 6, NA))
#' na_interp(c(NA, NA, 1, NA, 3, NA, NA, 6))
#' na_interp(c(0, rep(NA, 9), 1))
#'
#' @rdname na_mid
#' @export
na_interp <- function(x) {
.Call(`_misster_na_interp`, x)
}
#' Replace missing values with linear interpolation or midpoints
#'
#' @param x a vector.
#'
#' @examples
#'
#' na_mid(c(1, NA, NA, 4))
#' na_mid(c(1, 2, 3, NA, NA, 6))
#' na_mid(c(1, NA, 3, NA, NA, 6, NA))
#' na_mid(c(NA, NA, 1, NA, 3, NA, NA, 6))
#'
#' @export
na_mid <- function(x) {
.Call(`_misster_na_mid`, x)
}
#' Replace missing value with previous non-missing value
#'
#' @param x a vector.
#' @param lag replace \code{x[i]} missing value with the
#' \code{x[i-lag]} value.
#'
#' @examples
#'
#' na_prev( c(NA, 1, 2, NA, 3, NA, NA) )
#' na_prev( c(NA, 1.001, 2.5, NA, 3.0004, NA, NA) )
#' na_prev( c("a", NA, "b", NA, "c") )
#' na_prev( c(TRUE, NA, FALSE, NA, TRUE) )
#'
#' set.seed(1234)
#' x <- rep(1:7, 3)
#' x[sample(7*3, 5)] <- NA
#' x
#' na_prev(x, 7)
#'
#' @export
na_prev <- function(x, lag = 1L) {
.Call(`_misster_na_prev`, x, lag)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.