Description Usage Arguments Details Value Examples
Often when columns are operated on, their former name will no longer correctly indicate their properties. For example, when binary indicator variables are summed, they become integer count variables instead.
1 | rename_convo(vbls, convo)
|
vbls |
Character vector of variable names to transform |
convo |
|
This function allows users to specify the rename
property in their convo
to
explain how certain variables ought be renamed when transformed. It plays particularly nicely
with the automatic renaming conventions of dplyr
scoped operators, as shown in the second example.
Character vector of column names renamed per convo
specification
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | path <- system.file("", "ex-convo.yml", package = "convo")
convo <- read_convo(path)
vbl_names <- c("IND_A_AVG", "IND_B_SUM")
rename_convo(vbl_names, convo)
## Not run:
data.frame(
IND_A = sample(0:1, 10, replace = TRUE),
IND_B = sample(0:1, 10, replace = TRUE)
) %>%
summarize_all(list(SUM = sum, AVG = mean)) %>%
rename_all(~rename_convo(., convo))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.