The system cannot find the file specified in Rmarkdown

Hello guys. I have finished a project for a case study of Coursera. I am doing R Markdown, but is giving this error "The system cannot find the file specified because it says "combined_databike" cannot be found. The combined_databike is the data frame that I am using for my whole project, so I don't why R is not recognizing when I already did it on the R studio desktop.

When you knit an Rmd document the code gets executed in a clean environment other than the one you are currently working on so the mentioned data frame doesn't exist there. You need to include the necessary code to import the data frame into memory, in your Rmd document itself, for example, if the data frame comes from a csv file you would include something like this: your_data_frame <- read.csv("path_to_file.csv").

Hello Guys
I am doing my current project in RStudio Desktop. I am doing RMarkdown to later transfer. I am having some trouble getting an error of the system cannot find the file specified RMarkdown. At first, it says that the combined_databike was not found, but I literally did it in the same file already also you can see in the upper right all of the data frames which mention "combined_databike." This being said when I am trying to hit knit it gives me the error. Now the error says is at the tripdata_202006, which I cannot understand because I imported every file from tripdata_202006 to tripdata_202105 using the "import dataset."

I want to understand why is not working and how I bring a solution.

You have copied your code from console output including the "+" symbols that indicate a new line, you have to remove those, otherwise you get a syntax error.

Also, please do not post screenshots of your code, it is considered a bad practice here, post formatted code instead, here is how to do it.

1 Like
tripdata_202006 <- read_csv("Bike data/202006-divvy-tripdata.csv", 
                            +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                   +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                   +         start_station_id = col_character(), 
                                                   +         end_station_id = col_character()))
 View(tripdata_202006)                  july_2020 <- read_csv("Bike data 12 months/202007-divvy-tripdata/202007-divvy-tripdata.csv")


tripdata_202007 <- read_csv("Bike data/202007-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         start_station_id = col_character(), 
                                                     +         end_station_id = col_character()))
 View(tripdata_202007)  

 tripdata_202008 <- read_csv("Bike data/202008-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         start_station_id = col_character(), 
                                                     +         end_station_id = col_character()))
 View(tripdata_202008)    

 tripdata_202009 <- read_csv("Bike data/202009-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         start_station_id = col_character(), 
                                                     +         end_station_id = col_character()))
 View(tripdata_202009)   

 tripdata_202010 <- read_csv("Bike data/202010-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         start_station_id = col_character(), 
                                                     +         end_station_id = col_character()))
 View(tripdata_202010)

 tripdata_202011 <- read_csv("Bike data/202011-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         start_station_id = col_character(), 
                                                     +         end_station_id = col_character()))
 View(tripdata_202011)

 tripdata_202012 <- read_csv("Bike data/202012-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M")))
 View(tripdata_202012)

 tripdata_202101 <- read_csv("Bike data/202101-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M")))
 View(tripdata_202101)   

 tripdata_202102 <- read_csv("Bike data/202102-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M")))
 View(tripdata_202102)

 tripdata_202103 <- read_csv("Bike data/202103-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M")))
 View(tripdata_202103)    

 tripdata_202104 <- read_csv("Bike data/202104-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M")))
 View(tripdata_202104)

 tripdata_202105 <- read_csv("Bike data/202105-divvy-tripdata.csv", 
                              +     col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"), 
                                                     +         ended_at = col_datetime(format = "%m/%d/%Y %H:%M")))
 View(tripdata_202105)

Hi andresrcs,
That is true that is from the console because when I uploaded my files I used the "import dataset" which in the console results in this
`tripdata_202006 <- read_csv("Bike data/202006-divvy-tripdata.csv",
+ col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"),
+ ended_at = col_datetime(format = "%m/%d/%Y %H:%M"),
+ start_station_id = col_character(),
+ end_station_id = col_character()))
View(tripdata_202006) july_2020 <- read_csv("Bike data 12 months/202007-divvy-tripdata/202007-divvy-tripdata.csv")
I changed the columns start_at, ended_at to DateTime and start_station_id and end_station_id to double. But why R is not recognized because of the + sign?

Because using "+" signs for newlines is not part of the R syntax, those are just an artifact from the console, the correct way of writing it on a script is this one

tripdata_202006 <- read_csv("Bike data/202006-divvy-tripdata.csv",
                            col_types = cols(started_at = col_datetime(format = "%m/%d/%Y %H:%M"),
                                             ended_at = col_datetime(format = "%m/%d/%Y %H:%M"),
                                             start_station_id = col_character(),
                                             end_station_id = col_character())
                            )
2 Likes

Andresrcs the code worked and finally I could knit the Rmarkdown. Thank you very much

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.