To import our Dataset, first, we have to set a working directory. To do this, go to ‘Files’, at the bottom left corner of RStudio and navigate to where you stored the ‘Data.csv’ file. Under ‘More‘, select ‘Set as working directory‘. Once inside this directory, open a new R file in RStudio and name it ‘data_preprocessing.R’. Save this file in the same directory.
In this file, we will need only one line of code to import our data set from the ‘.csv’ file. We need to create a variable that will be the data set itself, we will call this variable ‘dataset‘. Type dataset = read.csv(‘Data.csv’) . Select the line you just added and then press the ‘Ctrl + Enter’ Keys on your keyboard to execute the command.
Under the ‘Environment’ section, you should see the data set you imported. Double-click on it and you’ll see the data set in RStudio.
As you can see, here the indexes start at 1 unlike in Python where they start at 0.
Some Really Useful Data Science and Machine Learning Books
We have imported our Dataset. Let’s continue with Taking care of Missing Data in the next article. Please share this article. Remember to subscribe, to get notified every time we post. Thank you.