Cannot Import CSV data

If you are having trouble with a specific rstudio.cloud project, be sure to include the URL of your project.

Be careful about sharing any private data or personally identifying information in the projects you make public.
--> I am taking Googles Data Analytics Certification and in Course 7 Week 3 there is an assignment which ask us to import data from a csv file using the read_csv () function.
All packages are installed and loaded -tidyverse, etc. the instructions state to use a read_csv ("hotel_bookings.csv") and save it as a data frame called bookings_df
When I run it I get this error > read_csv("hotel_bookings.csv")
Error: 'hotel_bookings.csv' does not exist in current working directory ('/cloud/project').
The instructions state that if I were to get an error to place setwd("projects/Course 7 Week 3 before it, I then ran

setwd("projects/Course7/Week3,read_csv("hotel_bookings.csv")
Error: unexpected symbol in "setwd("projects/Course7/Week3,read_csv("hotel_bookings.csv"
reading the error, I reran the code -
setwd("projects/Course 7/Week 3)read_csv(hotel_bookings.csv) and I got the same error
Error: 'hotel_bookings.csv' does not exist in current working directory ('/cloud/project').
The csv file was initially downloaded so it exist on my PC as well as in the folder for this lesson.
Hotel booking demand | Kaggle

you can check were R looks for the file / were your working directory is by using getwd()

I would recommend to add the full path (e.g. C:/Users/yourname/documents...) as everything else is relative, without knowin were R looks for you cannot be sure if you can adress the subfolder "projects/Course7" from there.
Instead of using setwd() you could also add the full path within the read_csv() function (read_csv("c:/users/yourname/documents/projects/Course7/hotel_bookings.csv") but then you also need to do this when exporting the results.

Probably the smartest way is to start a "Project" in RStudio in the folder were your data is, then it's used automatically as working directory without any further input from your side.

Try the solution from this similar posting:

Also, I do not believe that RStudio Cloud can access the C: drive on your computer.

I am taking the same course, same section.
After using the advice above regarding directory/locations here is what worked for me:

Location ->
/cloud/project/Course 7/Week 3/hotel_bookings.csv

Use->
setwd("/cloud/project/Course 7/Week 3")

Then ->
bookings_df <- read_csv("hotel_bookings.csv")

This topic was automatically closed 21 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.