-
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
Feature requests: Simple manipulations of variable labels #153
Comments
Dear @sda030 Yes such a function could be considered to be added in the package. I'm currently traveling for work reasons, but I would be happy to look at a PR. Best regards |
Hi. Are you still interested in such feature? What about two functions These two functions will be applied only to data.frames. |
That sounds excellent Joseph! I attempted one myself but was unsatisfied with lack of vectorization. Then looked into Rust but never got around to a solution. I'm sure you can do something better than me. |
…s_with()` allowing to update variable/value labels with a custom function fix #153
you may have a look and test #158 |
Works well! This will assist my colleagues so much. |
* new functions `update_variable_labels_with()` and `update_value_labels_with()` allowing to update variable/value labels with a custom function fix #153 * pkgdown * typo * typo * update github actions * additional tests * lint * wordlist
Hi Joseph, I was wondering whether something like the following would be something to include in the package? It is relatively easy to do it in a script for an intermediate R user, but I have newbie colleagues who find it a bit overwhelming/complicated to set up a loop across variable labels, etc. And cleaning variable labels are very important, as you might know, in the social sciences for effective science outreach.
Imagine this generalized solution to the common problem of wanting to generally process many variables' labels.
labelled::process_var_labels(data, ..., .f = ~stringr::str_replace_all(.x, pattern = "sad socks", replacement = "Happy socks")) # returns dataframe/tibble.
The elipses would preferably take tidyselect-notation.
The stringr-function can of course be replaced by the user to something like str_trim, etc.
Not very advanced to implement and maintain, the tidyselect you already have in the package. To ensure that stringr/stringi works as efficiently as possible, it would probably be best to first extract all the labels into a named vector, and then process them.
Let me know if you are too busy and I could try something.
P.S. Function should ignore NULL-labels, yet return the correct labels to each variable..
The text was updated successfully, but these errors were encountered: