R Markdown - object not found

Hi!
I have this issue:
when I start rendering my code, at about 50% of the renderin, I receive this message: "Error in as.Date(trips$started_at): object "trips" not found"

This is the piece of code:

```{r uniendo_bases, eval=FALSE, include=FALSE}
trips <- rbind(`202206.divvy.tripdata`, `202205.divvy.tripdata`, `202204.divvy.tripdata`, `202203.divvy.tripdata`, `202202.divvy.tripdata`, 
`202201.divvy.tripdata`, `202112.divvy.tripdata`, `202111.divvy.tripdata`, `202110.divvy.tripdata`, `202109.divvy.tripdata`, 
`202108.divvy.tripdata`, `202107.divvy.tripdata`)
```

```{r removiendo_NA, eval=FALSE, include=FALSE}
trips <- na.omit(trips)
```

```{r}
install.packages("lubridate")
library(lubridate)

# Definir nuevas variables: Date, Month, Day, Year, Day_of_week

trips$date <- as.Date(trips$started_at) # El formato por defecto el YYYY-MM-DD
trips$Month <- format(as.Date(trips$date), "%m")
trips$Day <- format(as.Date(trips$date), "%d")
trips$Year <- format(as.Date(trips$date), "%Y")
trips$Day_of_week <- format(as.Date(trips$date), "%A")
```

When I run the code as a script.R, it runs perfect (as well directly in the chunk in R markdown).

Thank you all for any piece of advice.

You have set the code chunks to eval=FALSE so they do not get executed when the file is knitted. Remove that chunk option

1 Like

Thank you very much @andresrcs ! Problem solved.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.