In ui.R I have:
fileInput('file1', 'Run code a',
accept=c('text/csv','text/comma-separated-values,text/plain','.csv'))
in server.R I have:
file1 = input$file1
if (is.null(file1)) {
return(NULL)
}
df = read.csv(file1$datapath)
... some code used by df
This is working fine, but I want to add another fileinput in ui, which then is used to fill the df variable.
so in ui.R it will look like :
fileInput('file1', 'Run code a',
accept=c('text/csv','text/comma-separated-values,text/plain','.csv')),
fileInput('file2', 'Run code b',
accept=c('text/csv','text/comma-separated-values,text/plain','.csv')),
but how do I make it work in server.R?
file1 = input$file1
if (is.null(file1)) {
return(NULL)
}
file2 = input$file2
if (is.null(file2)) {
return(NULL)
}
df = read.csv(file1$datapath)
df = read.csv(file2$datapath)
... some code used by df
So if I upload a file in file2 fileinput, then the df is filled with that csv.
This isn't working, but I think I have to use a if condition, but I'm not sure about that and don't know how I should do it.
Aucun commentaire:
Enregistrer un commentaire