doesn´t find my dataframe

Hi there. I am trying to run my first aplication, but I cannot do it. Mi shinyApp is working on my console, but can´t send it to the web. It says "It doesn´t find the dataframe. I have read the problema people have in the community with that, but I can´t find the solution. I hope someone had the same problem and can help me. Thank you before you try. Rubén.
If it´s worth it, here is my code:


coronavirus <- read.csv("cor13-04-2020/covid_19_data.csv")

coronavirus_resume <- select(coronavirus, ObservationDate, Country.Region, Confirmed, Deaths, Recovered)

coronavirus_total <- coronavirus_resume %>% group_by(Country.Region, ObservationDate) %>% summarise(Confirmed = sum(Confirmed),Deaths = sum(Deaths),Recovered = sum(Recovered))

r shiny

ui <- (fluidPage(
titlePanel("Introduction table of COVID-19"),
selectInput("instate", "select a country", choices = coronavirus_total$Country.Region)

                    tabPanel("Summary", verbatimTextOutput("summary")),
                    tabPanel("Structure", verbatimTextOutput("str")),
                    tabPanel("Data", dataTableOutput("tab")))



server <- (shinyServer(function(input,output){
output$summary <- renderPrint({
coronavirus_total %>%
filter(.,Country.Region %in% input$instate
) %>% summary()

output$str <- renderPrint({
    coronavirus_total %>%
        filter(.,Country.Region %in% input$instate
        ) %>% str()

output$tab <- renderDataTable((
    coronavirus_total %>%
        filter(.,Country.Region %in% input$instate)


shinyApp(ui = ui, server = server)

Hi Ruben,

First of all, you should not use setwd in your code in a Shiny app (and it is preferable not to use it in general).

Provided you have uploaded the covid_19_data.csv in the same folder as the app when publishing it to, you should be able to do.


If that doesn't work you could perhaps post a picture of the publishing pop-up window to show how the covid_19_data.csv file is uploaded to For example:


Hi Hlynur. Thank you for replying. I think i am doing what you told me, but I don´t know what happened. This is what I get:

I don´t know how do you do that about "Publish files from---" the two files, I only get the app

If you copy the csv file to the app folder of the app you want to publish you will be prompted to "tick" the csv and publish that also to In short, it has to be in the same folder for you to publish it also :slight_smile:

Mmm I put all in the same folder "app", and the code as you told me like this:


And it can´t find the csv, as it´s not on the R enviroment I guess...I don´t know if I have to put it inside and how…

In this latest post, is this an error that shows up on your local computer or on shinyapps?

running read.csv("covid_19_data.csv") won't work locally, but it will work on shinyapps.

For the shinyapp publishing the file needs to be in the app folder but that would mean that if you were to run this locally you'd have to run read.csv("app_folder/covid_19_data.csv.

Here's an example app.

# My app folder is named temp_app


# mtcars %>%
#     write_csv(path = here("mtcars.csv"))
# fs::file_copy(path = here("mtcars.csv"),
#               new_path = here("temp_app/mtcars.csv"))

my_mtcars <- read_csv("mtcars.csv")

# Define UI
ui <- fluidPage(

    # Application title
    titlePanel("mtcars as read from a csv"),

    # Sidebar with a slider input
                        "Filter HP:",
                        min = 0,
                        max = 500,
                        value = c(0, 400),
                        step = 10)

        # Show a plot

# Define server logic
server <- function(input, output) {

    output$carPlot <- renderPlot({
        my_mtcars %>% 
            filter(hp >= input$filter_sel[1],
                   hp <= input$filter_sel[2]) %>% 
            ggplot(aes(x = hp, y = mpg)) + geom_point()

# Run the application 
shinyApp(ui = ui, server = server)

I copied the file so it was in two locations to make this easier. This is an app that you can both run locally with this exact code, and it will run on shinyapps without any changes.

My app file is at temp_app/app.R my csv is at temp_app/mtcars.csv on my local computer so they are in the same app folder. So when I go to publish the app, I get the option to publish also the csv file, as you can see here.

Here's the link to the app, working on shinyapps:

And just to be clear, when I say "app folder", I mean the one folder that contains the app.R file :slight_smile:

Oh yes I get now what you are trying to tell me!. I put the csv "covid_19_data.csv" in the same folder than the "app.R" on my Desktop. Also do the Reading of it on the same window in Rstudio like this:

And it should work as I can see the two files:
But when I run it I get the server error. I think it´s the RStudio web, that is not working now...but if there´s something you think I am doing wrong you can tell me, I hear you.

Thank you very much for your help!!!


I've never had that error before, but a 402 error code means "payment required", I'm wondering if during these test runs you've reached the maximum allowed number of apps for your payment (or free) tier. That would simply mean that you'd have to remove some apps from your shinyapps account.

If I were you, I'd go to the website. Go to the dashboard. Under "Recent applications" click the name of an app you're willing to remove and on that app's site click "Delete" in the upper right corner. At least that's what I'd try :slight_smile:

OMG after doing what you told me for a long time I finally got it!! Thank you very muuuch! I really appreciate your effort in helping me!

Have a nice day.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.