Data set
We will be using iris dataset from R. A. Fisher’s famous research. Click here to download a .csv file of the document and save it as irisdata.csv.
For the purpose of this tutorial, I have a folder called r101 on my Desktop. I have downloaded irisdata.csv inside this folder.
Set working directory
I will set my working directory to the folder r101 where irisdata.csv is located.
setwd("~/Desktop/r101")
This sets the working directory for us. This can also be done by clicking Session > Set Working Directory > Choose Directory and then locate your recently created r101 directory and click Open
I can check my current working directory by using:
getwd()
## [1] "C:/Users/dpaudel/Desktop/r101"
We can see the files inside the folder by using the following codes:
list.files()
## [1] "irisdata.csv"
The list shows that the dataset we will be using (irisdata.csv) is present in our working directory r101.