-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Description
Hi,
I wanted to clean a vector where empty strings should be kept as empty strings.
x <- c("A 1", NA, "")
janitor::make_clean_names(string = x, empty_fill = "")
[1] "a_1" "na" "x"
The output is not what I expected it to be.
In the documentation, it is stated:
.. | Arguments passed on to snakecase::to_any_case
empty_fill: A string. If it is supplied, then each entry that matches "" will be replaced by the supplied string to this argument.
I would have expected
[1] "a_1" "na" ""
When I looked into the function, the internal problem is that the call to snakecase::to_any_case receives made_names, which is already pre-cleaned. Only when setting the option use_make_names = FALSE the parameter empty_fill triggers correctly.
janitor::make_clean_names(string = x, empty_fill = "", use_make_names = FALSE)
[1] "a_1" NA ""
I think updating the documentation to make this clearer might help.
Metadata
Metadata
Assignees
Labels
No labels