I'm trying to evaluate a glue
template row by row inside a data.frame.
library(tidyr)
library(dplyr)
library(glue)
expand_grid(var1 = c("A", "B"),
var2 = c("x", "y", "z")) %>%
full_join(data.frame(text_model = c("First {var1} and then {var2}",
"First {var2} and then {var1}"))
, by = character()) %>%
mutate(text_output = glue(text_model))
Here the text_output
creation doesn't work. Any advice ?