I have been writing a program using shiny where I need to access the fileInput from the user. Here is a code exert.
for (machine in 1:machineCount)
{
curFileID <- paste0("file", machine)
print(paste0("Current File ID: ", curFileID))
print(paste0("Current File ID input accessed through variable: ", input$curFileID))
print(paste0("Current File ID input accessed directly through variable name:", input$file1))
}
and here is the output
*[1] "Current File ID: file1"
[1] "Current File ID input accessed through variable: "
[1] "Current File ID input accessed directly through file ID:COPYING.txt"
[2] "Current File ID input accessed directly through file ID:35727"
[3] "Current File ID input accessed directly through file ID:"
[4] "Current File ID input accessed directly through file ID:C:\Users\fabma\AppData\Local\Temp\RtmpYV0PCn"*
You can see that when I used a variable to store the ID it does not work and input$variable returns NULL. However when I directly access with input$fileID then it works. I don't understand why this happens and how to solve it.