The working directory is just a file path on your computer that sets the default location of any files you read into R, or save out of R. In other words, a working directory is like a little flag somewhere on your computer which is tied to a specific analysis project. If you ask R to import a data set from a csv file, or save a data frame as a csv file, it will assume that the file is inside of your working directory. (Source: https://bookdown.org/ndphillips/YaRrr/the-working-directory.html)
When you will download the AdoptedSamp (2).csv file in your laptop it will be saved in your download folder. We are going to make the download folder your working directory so that R ca read the csv file.
You must make sure that R has its working directory set to where this file is located. You need to do this every time need to load a file. (The only exception is if you use RStudio projects).
getwd()
Now please save your rmarkdown file in the Downloads folder. Use the File menu on the top and then select save as and save it in the Downloads folder You can also check the names of the files in your working directory by using following code
list.files()
Please check the “AdoptedSamp (2).csv” file in the list. If you have lots of files in the working directory, you can search for the file specifically with list.files(pattern = “AdoptedSamp”)
list.files(pattern = "AdoptedSamp")
CSV files can be read in with the read.csv() function. We are uploading the csv file and saving is as adopt data frame.
adopt= read.csv("AdoptedSamp (2).csv")
Now you will see the adopt data frame in your environment.