[英]r shiny slider range to graph
编辑:澄清一下,使我的波形图的功能需要“区域”(状态)和“值”列,并根据值在刻度上的位置简单地对区域进行颜色编码。
我想使“值”列动态化,并让图形引用动态列
我不确定是否可以从输出对象读取
我的滑杆范围是2000-2014,列为x2000-x2014。
我希望滑块更改要绘制图形的数据,因此,如果选择2002-2010,它将显示该数据等。
它是一个显示两个年份之间变化百分比的曲线图,因此,如果我在滑块上选择2004和2007,我希望它拉(x2007-x2004)/ x2004。 我可以将其更改为X2004(low <-paste0(“ X”,input $ range [1])),但我不能真正做到df $ low。
如果我正确阅读了该问题,则可以使用要访问的数据框中的列名创建一个字符串( low
是数据帧df
中的列名),但是您尝试访问该字符串使用df$low
列不起作用。 那是对的吗?
如果是这样,那么实际上有一笔运气:
> library(fortunes)
> fortune('toad')
The problem here is that the $ notation is a magical shortcut and
like any other magic if used incorrectly is likely to do the
programmatic equivalent of turning yourself into a toad.
-- Greg Snow (in response to a user that wanted to access a
column whose name is stored in y via x$y rather than x[[y]])
R-help (February 2012)
您问题的答案在引号的底部,并且在帮助页面help('$')
和An Introduction to R中的6.1节中进行了详细说明 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.