how to import data ?

bookings_df <- read_csv("hotel_bookings.csv") when i write this error coming?

What is the complete text of the error?

1 Like

I suggest you use read.csv rather than read_csv which requires the additional step of loading a package.

Your code assumes this file exists on your computer, in the current working directory for R.

If this is not true, then include a full path from where the file exists. For example, if it is in your download folder then your path is something like C:/Users/tanya/Download/ which needs to come before hotel_bookings.csv

1 Like

Is this for the Google Data Analytics course? Are you using Posit Cloud (formerly Rstudio Cloud)? If so, the file is in a folder that you need to specify. Try read_csv("Course 7/Week 3/hotel_bookings.csv")

1 Like

Hi @tanya_Singh, maybe you need put more specific the path of this file in your pc.

file.choose() # show a new window for find the file. The console show the path.

Next copy and paste. (''path")

# If the file is in downloads the is some thing like that:
bookings_df <- read_csv("C:\\Users\\your_user\\Downloads\\hotel_bookings.csv")
2 Likes

Hello. Please i followed the step by step process in the google data analytics course to export my R Mark down document. However, when i click on Knit, i get an error message saying "no such file or directory" kindly assist please

Hello. Please i followed the step by step process in the google data analytics course to export my R Mark down document. However, when i click on Knit, i get an error message saying "no such file or directory" kindly assist please

As has been suggested above, you need to write out the path to the file. Are you using R on Posit Cloud or are you working on your local computer? There are suggestions for each situation posted above.

1 Like

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.