I'm using reactive function in order to do the 2 things at the same time:
- read the upload csv file;
- get the file name
see the code below:
file_info<-reactive({
filename <- file.choose()
data <- read.csv(filename, skip=1)
file_name <- basename(filename)
})
however, the file_info() only contains the file_name, which forces to me to write another reactive function to get the data uploaded:
Raw<- reactive({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
Raw<-read.csv(inFile$datapath, header=TRUE ,sep=",")
})
I think there should be another efficient way to do this, thanks in advance for any suggestions.
file_info
:list(data=data, file_name=file_name)
. Then, when you callfile_info()
you get a list with the file name and the data. – nicolafileInput
instead offile.choose
. – user5029763