I am trying to run a shiny application through a function called "OpenTree()", this function help me to start my application in the background but the issue that I have is that the argument of this function is fileName. I want that my shinyapp recognize the fileName that the function OpenTree returns and then deploy the app.
Example
createTree <- function(fileName) {
path_aux <- paste0("output/OpenTree_",fileName, ".json")
path_aux <- paste0(path_aux)
assign("path", path_aux, envir = .GlobalEnv)
assign("fileName", path_aux, envir = .GlobalEnv)
rstudioapi::jobRunScript(path = "shiny-run.R")
return(fileName)
}
This is my server
server <- function(input, output, session){
# First Message
message <- paste0("OpenTree will save your changes to the tree structure in real-time to output/", fileName, ".json")
# send the message to the event handler with name handler1 if we press the action button
session$sendCustomMessage("handler1", message)
# This block fires each time we receive a message from JavaScript
output$table2 <- renderTable({
#Write json file
json_value = input$jsonData
write(json_value, paste0("output/",fileName, ".json"))
})
}
Error
Error in paste0("OpenTree will save your changes to the tree structure in real-time to output/", : object 'fileName' not found