-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default values of to_numeric()
#544
Comments
I don't have a strong opinion on this (especially since I don't use this function), but since the next release is 0.13.0 and already contains a breaking change, it might be a good time to change this behavior too. |
Btw I lost track a bit of whether we had a discussion on this but is there any reason for having |
Not sure about the current state, but we had: I think the functions behave slightly different, and we needed both, at some point decided to make it (or keep it) exported. The major difference is that |
See datawizard::coerce_to_numeric(c("1", "2", "3"))
#> [1] 1 2 3
datawizard::to_numeric(c("1", "2", "3"))
#> [1] 1 2 3
datawizard::coerce_to_numeric(c("1", "2", "A"))
#> [1] "1" "2" "A"
datawizard::to_numeric(factor(c("1", "2", "A")))
#> 1 2 A
#> 1 1 0 0
#> 2 0 1 0
#> 3 0 0 1
datawizard::to_numeric(factor(c("1", "2", "A")), dummy_factors = FALSE)
#> [1] 1 2 3 Created on 2024-10-02 with reprex v2.1.1 |
(in the above example you may see why |
Let me know, I can make the changes and commit them to #546. |
Regarding easystats/easystats#434, I was thinking what would be a good default for the
dummy_factors
argument into_numeric()
? Currently, the default isTRUE
, splitting one variable into multiple ones.Personally, I think this - as default - is a bit odd and I would expect a "numeric" variant of the factor, what
dummy_factors = FALSE
returns by default.WDYT?
The text was updated successfully, but these errors were encountered: