r - Issue with loading data from ISLR package -


i r newbie , looking @ book an introduction statistical learning applications in r. many of examples use package islr. unfortunately, struggle example: install package (i have tried in r , rstudio) , execute following code

auto=read.table("auto.data") 

when that, following error message:

error in file(file, "rt") : cannot open connection
in addition: warning message:
in file(file, "rt") :
cannot open file 'auto.data': no such file or directory

i tried attach package command library(islr) after downloading - without success. not sure if issue related path of package don't believe so. @ least tried save package in working directory.

i feel bit stupid task looks more easy. if out, appreciated. related (including pdf of book can found here

just use

library(islr) 

then auto dataset becomes available:

> head(auto)   mpg cylinders displacement horsepower weight acceleration year origin                      name 1  18         8          307        130   3504         12.0   70      1 chevrolet chevelle malibu 2  15         8          350        165   3693         11.5   70      1         buick skylark 320 3  18         8          318        150   3436         11.0   70      1        plymouth satellite 4  16         8          304        150   3433         12.0   70      1             amc rebel sst 5  17         8          302        140   3449         10.5   70      1               ford torino 6  15         8          429        198   4341         10.0   70      1          ford galaxie 500 

please read book carefully. excerpt page 48:

we begin loading in auto data set. data part of islr library (we discuss libraries in chapter 3) illustrate read.table() function load text file. following command load the auto.data file r , store object called auto , in format referred data frame. (the text file data frame can obtained book’s website.)

(emphasis added).

here link file should saved in working directory:

http://www-bcf.usc.edu/~gareth/isl/auto.data

once file saved name auto.data in working directory, command

auto <- read.table("auto.data") 

should work without problem.

better results obtained using

auto <- read.table("auto.data", header=true) 

as described later in book.