Error in shiny R "Warning: Error in read.table: 'file' must be a character string or connection"

0 votes

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")
}

and I end up with the following error:

Warning: Error in read.table: 'file' must be a character string or connection
Dec 5, 2018 in Data Analytics by Ali
• 10,430 points
883 views

1 answer to this question.

0 votes

Your if statement in the server.R is wrong. It should be like this:

if (is.null(inFile)) {
     return(NULL)
   }
answered Dec 5, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

0 votes
1 answer

How can I read a .csv file in R language?

read.csv () function is used to read ...READ MORE

answered Jun 11, 2018 in Data Analytics by zombie
• 3,690 points
49 views
0 votes
1 answer
0 votes
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,040 points
468 views
0 votes
1 answer

Error saying "could not find function dashboardPage" in shiny R

Include this line in the code: Library(shinydashboard) READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,040 points
285 views