我想在每次用户点击开始时运行bash脚本。下面是一个小例子,但似乎每次用户点击开始按钮时系统命令都无法运行。
library(shiny)
library(datasets)
function(input, output) {
# Return the requested dataset
datasetInput <- reactive({
switch(input$dataset,
"rock" = rock,
"pressure" = pressure,
"cars" = cars)
})
output$summary <- renderPrint({
dataset <- datasetInput()
summary(dataset)
})
output$bash <- renderPrint({
system("./test.sh")
df_1<-data.table::fread("test.txt")
df_1
})
}
library(shiny)
fluidPage(
# Application title
titlePanel("Shiny Text"),
# Sidebar with controls to select a dataset and specify the
# number of observations to view
sidebarLayout(
sidebarPanel(
selectInput("dataset", "Choose a dataset:",
choices = c("rock", "pressure", "cars")),
actionButton("button", "Start")
),
# Show a summary of the dataset and an HTML table with the
# requested number of observations
mainPanel(
verbatimTextOutput("summary"),
verbatimTextOutput("bash")
)
)
)
date >> test.txt