Here is an example that works. the GUI displays the selectInput box, the server renders selectInput Box and collects input, Collected input is sent to a function. This function sends the input to anther function. Something happens in the second function. The second function returns a function to the first function and the server function renders that value which is displayed by the GUI. I thought this is a very complex way to go about it and I was wondering it there was a Sniny compatible way to pick up the input directly from the first or second function.
Thanks
ui <- fluidPage(
selectInput("Countparamsfile", label = h5(strong("Do you have a parameters file ready to use (Y/N)? ")),
choices = c("", "Y", "N"),selected = NULL),
verbatimTextOutput("CountparmsFile"),
selectInput("selectdatafiles",label = h5(strong("SELECT YOUR DATA FILE. To undo selection select the selected file again and press delete")),c(Choose='', list.files("~/Development/fileTest/GLYCOUNT/DATA")), multiple=TRUE, selectize=TRUE),
verbatimTextOutput("selecteddatafiles"),
verbatimTextOutput("inputTheFiles"),
)
server <- function(input, output, session{
output$glyCountparmsFile <- renderPrint({
shinyjs::show("Countparamsfile")
})
output$selecteddatafiles <- renderPrint({
result <- Counts()
filesOfData <- input$Countparamsfile
if(filesOfData == "Y" ){
shinyjs::show("selectdatafiles")
}
if(filesOfData == "N"){
shinyjs::hide("selectdatafiles")
}
})
output$inputTheFiles <- renderPrint({
fOfData <- unlist(input$selectdatafiles)
if(!is.null(fOfData)){
result <- Counts(fOfData)
receivedvalue <- paste(result$dataFnd, dataFnsDir
receivedValue
}
})
}
function <- Counts(inFileName, fOfData = NULL){
if(!is.null(fOfData)){
fileChoice = fOfData
}
List[dataFns, dataFnsDir] <- Counts2(fileChoice = fileChoice)
list(dataFns = dataFns, dataFnsDir = dataFnsDir)
}
function <- Counts2(fileChoice = NULL){
fileChosen = NULL
fileValue = FALSE
if(!is.null(fileChoice)){
fileChosen = fileChoice
dataFns <- fileChoice
dataFns<- sort(unique(dataFns))
dataFnsDir<- dirname(dataFns[1])
}
#Value to return to the call to Counts function() made from Counts() function
list(dataFns= dataFns, dataFnsDir = dataFnsDir)
}
}