【发布时间】:2018-09-30 10:29:08
【问题描述】:
我正在创建一个 R Shiny 应用程序。一切正常,代码运行(我已将 cat() 函数放在所有其他代码中,我看到 R Studio 的控制台中一切正常),但我真的不知道如何在我的特定情况下显示表格。
我的 Shiny 应用接受用户输入并生成 2 个数据集。当用户按下我在界面(eventReactive)中放置的按钮时,它开始。
第一个(dataset_1)是通过 API 调用和几个清理步骤生成的。
第二个数据集(dataset_2)是从 dataset_1 中的治疗生成的。
如何构造 ui.R 和 server.R 代码以在用户界面中将 dataset_1 和 dataset_2(均为表格)显示为输出?
这是我当前的 ui 和服务器文件:
ui.R
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
textInput("myfirstinput"),
textInput("mysecondinput"),
actionButton("button")
),
mainPanel(
???????????
)
)
))
server.R
shinyServer(function(input, output) {
???????? <- eventReactive(input$button, {
input1 <- input$myfirstinput
input2 <- input$mysecondinput
#function Make dataset_1 from api call (based on input1 & input2)
dataset_1
#function clean dataset_1
#function Make dataset_2 from treatments in dataset_1
dataset_2
})
})
在 server.R 文件中,我真的不知道如何管理 eventReactive(请参阅“????????”),因为我正在生成 2 个数据集...
谢谢!
【问题讨论】: