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

Allow glue-styled pattern for data_rename() #563

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

strengejacke
Copy link
Member

library(datawizard)
head(data_rename(mtcars[1:3], c("mpg", "cyl", "disp"), "formerly_{col}"))
#>                   formerly_mpg formerly_cyl formerly_disp
#> Mazda RX4                 21.0            6           160
#> Mazda RX4 Wag             21.0            6           160
#> Datsun 710                22.8            4           108
#> Hornet 4 Drive            21.4            6           258
#> Hornet Sportabout         18.7            8           360
#> Valiant                   18.1            6           225
head(data_rename(mtcars[1:3], c("mpg", "cyl", "disp"), "{col}_is_column_{n}"))
#>                   mpg_is_column_1 cyl_is_column_2 disp_is_column_3
#> Mazda RX4                    21.0               6              160
#> Mazda RX4 Wag                21.0               6              160
#> Datsun 710                   22.8               4              108
#> Hornet 4 Drive               21.4               6              258
#> Hornet Sportabout            18.7               8              360
#> Valiant                      18.1               6              225

Created on 2024-11-21 with reprex v2.1.1

@strengejacke
Copy link
Member Author

@DominiqueMakowski @easystats/core-team any suggestions for further patterns?

@strengejacke strengejacke marked this pull request as ready for review November 21, 2024 21:39
@strengejacke
Copy link
Member Author

the many rd-files are just due to lintr-updates, can be ignored when reviewing this PR.

@strengejacke strengejacke changed the title Allow curl-styled pattern for data_rename() Allow glue-styled pattern for data_rename() Nov 22, 2024
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