I am working on an application in R where users need to select a file from their computer using the RShiny button fileInput. I want to change this so that a related variable can be assigned (for example, a file can be loaded) automatically by the program, without clicking on the user button and without selecting the file.
The problem that I am facing is that it fileInputhas 4 fields, among which I only know 3. For example, when I load a file hello.csvin a variable inFilethrough the usual procedure, here is what I get:
inFile$name = hello.csv
inFile$size = 8320
inFile$type = text/csv
inFile$datapath = C:\\Users\\MyName\\AppData\\Local\\Temp\\Rtmpkh8Zcb/7d5f0ff0111d440c7a66b656/0
Although I could guess that the second and third know the file, I have no idea how to assign the field datapath...
I tried declaring it inFileas a global variable NULLand then assigning different fields one at a time, but I was stuck with this last one. Is there another way to do it, like a function that mimics the behavior of a user who presses a file input button and selects a specified file?
Many thanks.
source
share