Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In the exercises below we cover the basics of reading delimited data. Before proceeding, first read section 7.1 of An Introduction to R, and the help pages for the read.table function.

Answers to the exercises are available here.

For each exercise we provide a data set that can be accessed through the link shown in the exercise. You can read the data from this link directly (clicking on it will show the url in the address bar of your browser), or you can download the data first to a local directory, and read it from there.

Exercise 1
a) Change the names of the columns to Name, Age, Height, Weight and Sex.
b) Change the row names so that they are the same as Name, and remove the variable Name.

Exercise 2
Read the file Table1.txt, how many rows and columns does it have?
a) Reread the file and make the variable Name be the row names. Make sure you read the variable as characters and not as factors.

Exercise 3
Read the file Table2.txt, watch out for the first line.

Exercise 4
Read the file Table3.txt, watch out for the first line and the missing values.

Exercise 5
Read the file Table4.txt, watch out for the missing values and the decimal separator.

Exercise 6
Read the file Table5.txt, watch out for the missing values and the decimal separator and the separator.

Exercise 7
Read the file states1.csv, the names of the states should be the row names.

Exercise 8
Read the file states2.csv, the names of the states should be the row names, watch out for the decimal separator and the separator.

Exercise 9
Read the file states2.csv, watch out for the same as the last exercise plus the missing values. Add to the previous dataset, column-wise.

Exercise 10
Read the file Table6.txt, check out the file first. Notice that the information is repeated, we only want the first non-repeated ones. Make sure to create only characters not factors this time around. Lastly, we don’t want the comments.