From f4c151fb6300a98d06622f3e440115c3434186eb Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 13 Feb 2026 14:13:15 +0100 Subject: [PATCH] Add small explanation to the docs --- R/recode_values.R | 9 +++++---- man/recode_values.Rd | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/R/recode_values.R b/R/recode_values.R index f164da53e..a00b97bbb 100644 --- a/R/recode_values.R +++ b/R/recode_values.R @@ -13,10 +13,11 @@ #' element names have to be surrounded in backticks. For example, #' ``recode=list(`0`=1)`` would recode all `1` into `0` in a numeric #' vector. See also 'Examples' and 'Details'. -#' @param default Defines the default value for all values that have -#' no match in the recode-pairs. Note that, if `preserve_na=FALSE`, missing -#' values (`NA`) are also captured by the `default` argument, and thus will -#' also be recoded into the specified value. See 'Examples' and 'Details'. +#' @param default Defines the default value for all values that have no match in +#' the recode-pairs. If `NULL`, original values will be preserved when there +#' is no match. Note that, if `preserve_na=FALSE`, missing values (`NA`) are +#' also captured by the `default` argument, and thus will also be recoded into +#' the specified value. See 'Examples' and 'Details'. #' @param preserve_na Logical, if `TRUE`, `NA` (missing values) are preserved. #' This overrides any other arguments, including `default`. Hence, if #' `preserve_na=TRUE`, `default` will no longer convert `NA` into the specified diff --git a/man/recode_values.Rd b/man/recode_values.Rd index b40bfacd2..1812034cb 100644 --- a/man/recode_values.Rd +++ b/man/recode_values.Rd @@ -44,10 +44,11 @@ element names have to be surrounded in backticks. For example, \code{recode=list(`0`=1)} would recode all \code{1} into \code{0} in a numeric vector. See also 'Examples' and 'Details'.} -\item{default}{Defines the default value for all values that have -no match in the recode-pairs. Note that, if \code{preserve_na=FALSE}, missing -values (\code{NA}) are also captured by the \code{default} argument, and thus will -also be recoded into the specified value. See 'Examples' and 'Details'.} +\item{default}{Defines the default value for all values that have no match in +the recode-pairs. If \code{NULL}, original values will be preserved when there +is no match. Note that, if \code{preserve_na=FALSE}, missing values (\code{NA}) are +also captured by the \code{default} argument, and thus will also be recoded into +the specified value. See 'Examples' and 'Details'.} \item{preserve_na}{Logical, if \code{TRUE}, \code{NA} (missing values) are preserved. This overrides any other arguments, including \code{default}. Hence, if