I'm extremely new at R/Shiny and am trying to figure out how to do a pretty simple if
statement. I have an observeEvent
which for whatever reason is being triggered twice... not worried about this right now. It can be triggered where inFile$datapath
has the actual datapath, and can be triggered when inFile$datapath
doesn't have the file path. I'm trying to write an if
statement to differentiate the two.
shinyFileChoose(input,'file', session=session,roots=c(wd='.'))
observeEvent(input$file, {
#print(input$file)
inFile <- parseFilePaths(roots=c(wd='.'), input$file)
print(inFile$datapath)
if (inFile$datapath == "") {
print("File Exists")
}
else {
session$reload()
print("No file found.")
}
})
On the print(inFile$datapath)
it outputs character(0)
. I can't figure out a way to test that value successfully in my if
statement without it giving me the error Error in if: argument is of length zero
.
Aucun commentaire:
Enregistrer un commentaire