Closed kylebaron closed 1 year ago
Hey @kylebaron,
I plan to come to this review soon - just knocking out some client work this week.
@kylebaron
The code looks good - I have a comment about a particular way this may get used, specifically:
ys_factors(data, spec, EVID, .keep_values = TRUE, .suffix = "")
The key part is .keep_values = TRUE, .suffix = ""
Do we want to disallow this option (or potentially set .suffix
to NULL
under the hood if its equal to ""
& .keep_values = TRUE
)?
Leaving as is maybe OK too.
@andersone1 - good question; let me confirm what the behavior is in this case.
@andersone1 - you are right; the factors were getting overwritten; I updated the logic in the code and added a test for this.
Summary
ys_add_factors(data, spec, .suffix = "")
ys_factors()
which converts columns to factors (doesn't add factor columns) and adds columns with the original valuesSpecifics
Example
ys_add_factors()
adds factor columnsys_factors()
turns columns to factors and adds columns with original values_v
suffixys_add_factors(..., .suffix = "")
Created on 2023-07-18 with reprex v2.0.2