Reputation: 1107
I have a shiny app in which you can upload an excel sheet. The code is like this:
fileInput("file1", "Choose file:",
multiple = FALSE,
accept = ".xlsx")
Now I want to add another fileInput
that is an optional (!) dataset. If I don't choose a file, the first dataset should be as is. If I choose a file, the first dataset should only contain those observations that are not in the optional second dataset based on one variable. Something like Data1[!Var %in% Data2[, Var]]
. The only thing I want to know is: How can I formulate the condition if a file is uploaded? Something like if(is_uploaded(input$file2))
.
Upvotes: 0
Views: 277
Reputation: 84519
When a file is uploaded, the associated input is not NULL
. So you can do
if(!is.null(input$file2))
Upvotes: 1