Skip to content
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

Preserve correct label oder #473

Merged
merged 6 commits into from
Dec 18, 2023
Merged

Preserve correct label oder #473

merged 6 commits into from
Dec 18, 2023

Conversation

strengejacke
Copy link
Member

@strengejacke strengejacke commented Dec 18, 2023

library(datawizard)
x <- factor(c(1, 2, 3, 4))
x <- assign_labels(x, values = c("one", "two", "three", "four"))

to_numeric(x, dummy_factors = FALSE)
#> [1] 1 2 3 4
#> attr(,"labels")
#>   one   two three  four 
#>     1     2     3     4

to_numeric(reverse_scale(x), dummy_factors = FALSE)
#> [1] 4 3 2 1
#> attr(,"labels")
#>   one   two three  four 
#>     4     3     2     1

Created on 2023-12-18 with reprex v2.0.2

Copy link
Member Author

@strengejacke strengejacke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was:

library(datawizard)
x <- factor(c(1, 2, 3, 4))
x <- assign_labels(x, values = c("one", "two", "three", "four"))

to_numeric(x, dummy_factors = FALSE)
#> [1] 1 2 3 4
#> attr(,"labels")
#>   one   two three  four 
#>   "4"   "3"   "2"   "1"

to_numeric(reverse_scale(x), dummy_factors = FALSE)
#> [1] 4 3 2 1
#> attr(,"labels")
#>   one   two three  four 
#>   "1"   "2"   "3"   "4"

packageVersion("datawizard")
#> [1] '0.9.0'

Created on 2023-12-18 with reprex v2.0.2

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (5f5c9c1) 89.10% compared to head (ba0471f) 89.09%.

Files Patch % Lines
R/utils_labels.R 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #473      +/-   ##
==========================================
- Coverage   89.10%   89.09%   -0.01%     
==========================================
  Files          72       72              
  Lines        5416     5422       +6     
==========================================
+ Hits         4826     4831       +5     
- Misses        590      591       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@strengejacke strengejacke merged commit 0e3991b into main Dec 18, 2023
26 of 28 checks passed
@strengejacke strengejacke deleted the fix_to_numeric branch December 18, 2023 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant