【发布时间】:2015-09-29 14:35:59
【问题描述】:
我有大约 50 个文件需要在 dataSource1、dataSource2 和 dataSource3 中调用。与其将其全部复制到每个 switch 语句中,不如我如何使用变量,这样我只需在代码顶部输入一次?我在server.R 中调用这个来作为一个闪亮的应用程序。
dataSource1 <- reactive({
switch(input$dataSelection1,
"File1" = File1,
"File2" = File2,
"File3" = File3,
"File50" = File50
)
)
相反,我想要:
dataSource1 <- reactive({
switch(input$dataSelection1,
FileNumber = File
)
)
dataSource2 <- reactive({
switch(input$dataSelection1,
FileNumber = File
)
)
dataSource2 <- reactive({
switch(input$dataSelection1,
FileNumber = File
)
)
【问题讨论】: