【发布时间】:2019-07-27 12:13:01
【问题描述】:
我正在创建一个使用 HighChart 作为绘图工具的函数。但是,当我在 hcaes() 函数中使用全局变量时,什么都没有绘制。让我们以 mtcars 数据集为例。
x = "mpg"
y = "hp"
hchart(mtcars, "point", hcaes(x = x, y = y, group = "cyl"))
#I am also attempting
hchart(mtcars, "point", hcaes(x = eval(x), y = eval(y), group = "cyl"))
#this works but, I want to use variables rather than the actual string.
hchart(mtcars, "point", hcaes(x = "mpg", y = "hp", group = "cyl"))
#The output I would like to see is
x = "mpg"
y = "hp"
hchart(mtcars, "point", hcaes(x = x, y = y, group = "cyl"))
【问题讨论】:
-
为什么这被否决了?有人可以生成一些可行的代码吗?
-
嗨。你的问题问得很好,我不知道为什么有人反对它。我试过但无法让它工作。我认为这是更多的 R 问题,而不是 Highcharts。也许您应该尝试在 R 支持论坛上创建一个主题?
标签: r highcharts shiny shinydashboard r-highcharter