Error in eval(exprs, envir) : object 'adult' not found


I am beginner and trying to test the code below but always the same error even with adults.csv in the same folder: Error in eval(exprs, envir) : object 'adult' not found
Is there anyone who could give a help?


ui <- fluidPage(
selectInput("workclass", "Select a workclass:",
choices = c("", unique(adult$workclass))), tableOutput("table") )

server <- function(input, output) {
adult <- read.csv("Adult.csv") # carrega o dataset
names(adult) <- tolower(names(adult))

filtered_data <- reactive({ adult%>%filter(if(input$workclass == "") TRUE else workclass == input$workclass) })

output$table <- renderTable({ filtered_data() }) }

shinyApp(ui, server)

Hi @Renata_Costa, about this:

This said that you don't load well the adult object.
An easy way is put the path of the file. You could find this with file.choose()

file.choose() # find the file and press OPEN. The console show the path. 
# copy and paste in :
adult <- read.csv("Paste_PASTH_HERE")

1 Like

It worked. I got it. Thanks, thanks!