Back
This is my code in shiny R
ui.R:fileInput("f1", "Load Input File", accept = c("text/csv", "text/comma-separated-values,text/plain",".csv") )server.R:execute = observeEvent(input$runButton, { output$plot1 = renderPlot({ inFile = input$file1 if (is.null(inFile)) { print(NULL) } podr_fun_graphs(inFile$datapath) })}podr_graphs function:podr_fun_graphs <- function(p) { df1 <- read.delim(p, sep = "\t")}
ui.R:
fileInput("f1",
"Load Input File",
accept = c("text/csv", "text/comma-separated-values,text/plain",".csv")
)
server.R:
execute = observeEvent(input$runButton, {
output$plot1 = renderPlot({
inFile = input$file1
if (is.null(inFile)) {
print(NULL)
}
podr_fun_graphs(inFile$datapath)
})
podr_graphs function:
podr_fun_graphs <- function(p) {
df1 <- read.delim(p, sep = "\t")
and I end up with the following error:
Warning: Error in read.table: 'file' must be a character string or connection
Your if statement in the server.R is wrong. It should be like this:
if (is.null(inFile)) { return(NULL) }
return(NULL)
Hope this answer helps you!
31k questions
32.8k answers
501 comments
693 users