setna_scale {tidycomm} | R Documentation |
Set specified values to NA in selected variables or entire data frame
Description
This function allows users to set specific values to NA
in chosen variables
within a data frame. It can handle numeric, character, and factor variables.
Usage
setna_scale(data, ..., value, name = NULL, overwrite = FALSE)
Arguments
data |
|
... |
One or more variables where specified values will be set to NA. If no variables are provided, the function is applied to the entire data frame. |
value |
A value (or vector of values) that needs to be set to NA. |
name |
The name of the new variable(s). By default, this is the same name
as the provided variable(s) but suffixed with |
overwrite |
Logical. If |
Value
A tdcmm model or a tibble.
See Also
Other scaling:
categorize_scale()
,
center_scale()
,
dummify_scale()
,
minmax_scale()
,
recode_cat_scale()
,
reverse_scale()
,
z_scale()
Examples
WoJ %>%
dplyr::select(autonomy_emphasis) %>%
setna_scale(autonomy_emphasis, value = 5)
WoJ %>%
dplyr::select(autonomy_emphasis) %>%
setna_scale(autonomy_emphasis, value = 5, name = "new_na_autonomy")
WoJ %>%
setna_scale(value = c(2, 3, 4), overwrite = TRUE)
WoJ %>%
dplyr::select(country) %>% setna_scale(country, value = "Germany")
WoJ %>%
dplyr::select(country) %>% setna_scale(country, value = c("Germany", "Switzerland"))