【发布时间】:2017-11-17 18:32:21
【问题描述】:
我正在尝试在 R Shiny 中创建散点图,其中用户从反应性 combodf1() 的列中选择 X 和 Y,该反应性是由其他反应性构建的。如果您将输入设置为x 和y 并直接将列名设置为有效,但是从input$metric_a 等设置它们(您可以看到选项的名称和combodf1() 的列相同) ,数据不存在。非常感谢这里的任何帮助!
Part of the UI:
selectInput("metric_a", "metric_a:",
c("Buzz" = "buzz",
"Aided" = "aided",
"Adaware" = "adaware")),
selectInput("metric_b", label = ("Metric B"),
c("Buzz" = "buzz",
"Aided" = "aided",
"Adaware" = "adaware")),
Part of the server:
combotest<- reactive({do.call(cbind, list(adaware()$Value, buzz()$Value, aided()$Value))})
combodf<- reactive({as.data.frame(combotest())})
# Renaming reactive cols - WORKS, PLYR function
combodf1<-reactive({rename(combodf(), c("V1"="adaware", "V2"='buzz', 'V3' = 'aided'))})
# PLOT
output$plot2<-renderPlot({
ggplot(data=combodf1(),aes(x=input$metric_a,y=input$metric_b))+geom_point(colour='red')})
}
【问题讨论】: