Scan exercises

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
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 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.

Exercise 1
Read the file scan01.txt as a vector.

Exercise 2
Read the file scan02.txt:
a) As a vector
b) As a matrix with 10 rows.

Exercise 3
Read the file scan03.txt as a vector.

Exercise 4
Read the file scan04.txt as a matrix of 2 columns. Read only the 5 first rows. Finally, convert it to a data frame.

Exercise 5
Read the file scan05.txt as a list.

Exercise 6
Read the file scan05.txt as a list, read only the first 50 rows.

Exercise 7
Read the file scan.csv as a list.

Exercise 8
Read the file scan06.txt as a list. Read 10 rows of data.

Exercise 9
Read the file scan07.txt as a list.

Exercise 10
Read the file scan2.csv as a list.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)