I want to get the result of a glue_collapse as character vector. For an example
library(palmerpenguins)
tibble(species=unique(penguins$species),
color=c("#FF6600","#047075","#C25BCC"))%>%
glue_data('"{species}"="{color}"') |>
glue_collapse(sep = ",")
My expected output is c("Adelie"="#FF6600 ", "Gentoo"="#047075 ","Chinstrap="#C25BCC ")
current output: "Adelie"="#FF6600 ","Gentoo"="#047075 ","Chinstrap"="#C25BCC "
Flm
October 15, 2022, 6:24am
2
This could be a solution
a <- tibble(species=unique(penguins$species),
color=c("#FF6600","#047075","#C25BCC"))%>%
glue_data('"{species}"="{color}"') |>
glue_collapse(sep = ",")
glue("c({a})")
1 Like
system
Closed
October 22, 2022, 7:04am
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.