R/RcppExports.R

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

#' Fast renumbering of missing id
#'
#' `frenum_miss()` will replace certain values with `NA`. For numeric vectors
#' ids coded as `0` or `-99` will be considered as missing or unknown. For
#' character vectors this is extended to include `'.'`, `'*'`, `'NA'` and `' '`.
#'
#' @param id a numeric or character vector for which the missing codes will be
#'   replaced with NA
#' @return a numeric or character vector
#'
#' @seealso [renum_miss()] which is the R implementation of the same
#'
#' @examples
#' set.seed(42L)
#' ids <- rpois(50, 100)
#' ids[sample.int(50, 10)] <- c(0L, -99)[sample.int(2, 10, replace = TRUE)]
#' frenum_miss(ids)
#'
#' ids <- c("A", "B", ".", "D", "*", "NA", " ", "  ", "K")
#' frenum_miss(ids)
#'
#' @backref src/frenum_miss.cpp
#' @export frenum_miss
frenum_miss <- function(id) {
    .Call('_pedr_frenum_miss', PACKAGE = 'pedr', id)
}
tstev/pedr documentation built on May 11, 2019, 4:06 p.m.