I want to produce this string:
All my variables: a, b, c
from this variable vars <- c("a", "b", "c")
using glue()
.
My best attempt so far is:
library(glue)
glue('All my variables: {paste(vars, collapse = ", ")}')
Question:
Is there any easier / cleaner way of to implement it that i oversee?
Other attempts:
The following obviously fail, i just want to show that i looked into the docu and made some effort :).
glue('All my variables: {vars}')
glue_data('All my variables: {vars}', .sep = ", ")
You can just do,
paste('All my variables:', toString(vars))
#[1] "All my variables: a, b, c"