I am trying to interleave two string vectors into a vector of, I believe, quosures with equal signs. Here is an example:
a <- c('coef_name1', 'coef_name2')
b <- c('clean_name1', 'clean_name2')
desired_output <- c('coef_name1'='clean_name1', 'coef_name2'='clean_name2')
As a first step I have tried interleaving, i.e.
c(rbind(a, b))
but I'm kind of stuck beyond that. I also tried creating a short quosure by hand, but
quo(a[1] = b[1])
does not work (it does work with '+' though)..
I need this, because I want to change the displayed coefficient names in coefplot::coefplot with the argument newNames. See page 9 of its documentation: https://cran.r-project.org/web/packages/coefplot/coefplot.pdf
Then I can do
coefplot::coefplot(model, newNames = desired_output, intercept = FALSE)
The coefplot documentation describes newNames
as a "Named character vector of new names for coefficients"
# b is a character vector without names
b <- c('clean_name1', 'clean_name2')
# give it names
a <- c('coef_name1', 'coef_name2')
names(b) <- a
# now b is a named character vector
# so this should work
coefplot::coefplot(model, newNames = b, intercept = FALSE)