我正在运行“下面的代码”,但是将输出与“ FALSE as Output”一起输出,有人可以指导我这样做的原因是什么?它应该只显示成功而不是FALSE。在下面的代码中,我将采购另一个代码testScript.R。以及testScript.R中的代码。 如果有人可以帮助,那就太好了
runApp(
list(
ui = fluidPage(
titlePanel("User Interface to Update Input(s)"),
sidebarLayout(
sidebarPanel(
selectInput("platform", "Platform:",
list(`14G` = c("R740","R840","R940XA"),
`15G` = c("R6515", "R7515","R7525", "R6525"))),
selectInput("test_Stage", "Test_Stage:",
c("BU", "UT","PT","ST"), selected = NULL, multiple = FALSE),
textInput("execution_Id", "JIRA_Card_No", NULL),
fileInput('SPM', 'SPM', multiple = TRUE,
accept = c(".xlsx")
),
actionButton("goButton", "Go!"),
uiOutput("selectfile")
),
#submitButton("Update View", icon("refresh")),
mainPanel(
tableOutput('SPM')
)
)
),
server = function(input, output) {
file_name <- reactive({
if((input$execution_Id=="") | is.null(input$SPM)) {return()}
else
setwd("C:\\R\\Shiny")
source('testScript.R', local = TRUE)
})
output$SPM <- renderUI( {file_name()})
}))
测试脚本
main_Folder <- input$execution_Id
prim_loc <- "C://R//Shiny//"
execution_Iterator <- 1
ifelse(!dir.exists((file.path(paste(paste(prim_loc,main_Folder, sep = ""), sep="//")))),
(dir.create(file.path(prim_loc, main_Folder))) &
(dir.create((file.path(paste(paste(prim_loc,main_Folder, sep = ""),execution_Iterator, sep="//"))))),
dir.create(file.path(paste(paste(prim_loc,main_Folder, sep = ""),(as.numeric(max(list.dirs(path = (file.path(prim_loc, main_Folder)), full.names = FALSE, recursive = FALSE))))+1, sep="//"))) )
new_folder <- (file.path(paste(prim_loc, main_Folder, (max(list.dirs(path = (file.path(prim_loc, main_Folder)), full.names = FALSE, recursive = FALSE))), sep ="//" )))
file.copy(input$SPM$datapath, paste0( new_folder,"//", input$SPM$name))
print("SUCCESS")