In the exercises below we cover the basics of the
scan function. Before proceeding, first read section 7.2 of An Introduction to R.
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 scan 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 scan it from there.
Read the file scan01.txt as a vector.
Read the file scan02.txt:
a) As a vector
b) As a matrix with 10 rows.
Read the file scan03.txt as a vector.
Read the file scan04.txt as a matrix of 2 columns. Read only the 5 first rows. Finally, convert it to a data frame.
Read the file scan05.txt as a list.
Read the file scan05.txt as a list, read only the first 50 rows.
Read the file scan.csv as a list.
Read the file scan06.txt as a list. Read 10 rows of data.
Read the file scan07.txt as a list.
Read the file scan2.csv as a list.