0

I have a shinyApp in which I want to visualize some data. The graphics function requires a colors argument, which is a list of the column names of the data frame going into the function and the corresponding colors. However, since the number of column names and the column names itself can be quite different due to user interactivity, I don't know how to put them into the colors argument's list.

library(tibble)

tibble::tibble(columnOne=1, columnTwo=2, columnThree=3)

tbl %>%
grapicFunction(data = ., colors = list(columnOne = "red", columnTwo = "green", columnThree = "yellow"))
marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
  • 1
    It would be easier to help you if you provide a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). But in general you could do something like `colors = as.list(setNames(c("red", "green", "yellow"), names(.)))`. – stefan Jul 04 '21 at 14:43

0 Answers0