1

I'm trying to make graph thanks to ggplot and shiny by using a csv file with data about food. The following code is working well.

p <- ggplot(data=Aliments, aes(x = Glucides, y = Proteines))
p <- p + geom_point()
p

However, the columns used to make the graph can change, the user has to decide. That's why i have to use this kind of code.

t <- c("Glucides", "Proteines")
p <- ggplot(data=Aliments, aes(x = t[1], y = t[2]))
p <- p + geom_point()
p

But t[1] is a str, and t[1] isn't recognize as the name of a column. Have you got an idea for this small problem ?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Celia
  • 21
  • 2

0 Answers0