Reading in your own data
In the last exercise, you just read in your first dataset. All you needed to specify was the "address" where the dataset could be found. However, sometimes data isn't stored into the most convenient format. For instance, sometimes the separator that separates all the different cells is different than you would expect.
You can specify the separator in your read.csv
function using the sep
argument. By default, this argument for csv files is a comma. You can however easily change this to a tab by using the following code: sep = '\t'
. In the current exercise, you will be working with the following url:
http://s3.amazonaws.com/assets.datacamp.com/course/uva/mtcars_semicolon.csv
This exercise is part of the course
Basic Statistics
Exercise instructions
- For this exercise we'll be working with the same dataset found at the following url specified above. The dataset however has a ";" as separator. Load in the dataset by specifying the ";" as separator. Save it in the variable
cars
- Print the first 6 rows of cars to the console using the
head()
function
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# load in the dataset
# print the first 6 rows of the dataset