-
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
Idea: implement set_var_labels_with
#163
Comments
larmarange
added a commit
that referenced
this issue
Oct 3, 2024
…variable name inside `.fn` by using `names()` fix #163
1 task
There is already an library(labelled)
iris |>
update_variable_labels_with(~ toupper(names(.x))) |>
look_for()
#> pos variable label col_type missing values
#> 1 Sepal.Length SEPAL.LENGTH dbl 0
#> 2 Sepal.Width SEPAL.WIDTH dbl 0
#> 3 Petal.Length PETAL.LENGTH dbl 0
#> 4 Petal.Width PETAL.WIDTH dbl 0
#> 5 Species SPECIES fct 0 setosa
#> versicolor
#> virginica Created on 2024-10-03 with reprex v2.1.1 |
OK thanks a lot, I didn't find this function earlier ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Firstly, I really enjoy this package ! I mainly use the
set_var_labels()
function to define variable labels to obtain nice summary tables withgtsummary
.However, I often think that it would be useful to have a function that sets variable labels based on the column names and that can be applied in the same way as
rename_with()
works.For example, if I have a data frame with columns
quest_1
toquest_10
, andlocation_A
tolocation_Z
, I wish there was a function I could use to do:Of course this is maybe a silly example, but I think that it could allow labelling variables within a pipe workflow, without having to manually generate labels when there are many columns.
The text was updated successfully, but these errors were encountered: