Unable to install package DAT 500 SNHU

Hi there,
I'm new to R and I'm having a lot of trouble with a homework assignment for class. We need to install a package "ISLR" into rstudio and then run something with it. I cannot install the package. I'm so unfamiliar with R that I don't know what to do. Can anyone give me advice on what to do? Thank you in advance. The error I get is below.

install.packages("ISLR")
Error in install.packages : Updating loaded packages

Restarting R session...

install.packages("ISLR")
Installing package into ‘/home/codio/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/ISLR_1.2.tar.gz'
Content type 'application/x-gzip' length 1757568 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

  • installing source package ‘ISLR’ ...
    ** package ‘ISLR’ successfully unpacked and MD5 sums checked
    ** data
    *** moving datasets to lazyload DB
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (ISLR)

The downloaded source packages are in
‘/tmp/RtmpN9vS8B/downloaded_packages’

It looks to me like you got it.

Try the command

library(ISLR)

If it does not return an error, you are good to go.

The error message only means that you were installing a package that was already installed and loaded. After restarting it went ahead and installed it again from source (which did not require compiling because there are no functions in this package, only datasets).

Thanks for the replies. HOWEVER, when I then try library(ISLR) and data(default) as instructed and after doing the install.packages command, I get this:

library(ISLR)
data(ISLR)
Warning message:
In data(ISLR) : data set ‘ISLR’ not found

Sorry, I realized I didn't reply to you. This is what I get when I enter that and try to do the other commands.
library(ISLR)
data(ISLR)
Warning message:
In data(ISLR) : data set ‘ISLR’ not found

Are you sure that is meant to be a command?

It isn't anywhere in here:

https://statlearning.com/All%20Labs.txt

and the website:

As far as I can see the

library(ISLR

loads the data sets.

To get the names of the data sets have a look at the manual https://cran.r-project.org/web/packages/ISLR/ISLR.pdf

or just use the command
data() without the name and scroll down the data sets until you hit

Data sets in package ‘ISLR’:

Auto Auto Data Set
Caravan The Insurance Company (TIC) Benchmark
Carseats Sales of Child Car Seats
College U.S. News and World Report's College Data
Credit Credit Card Balance Data
Default Credit Card Default Data
Hitters Baseball Data
Khan Khan Gene Data
NCI60 NCI 60 Data
OJ Orange Juice Data
Portfolio Portfolio Data
Smarket S&P Stock Market Data
Wage Mid-Atlantic Wage Data
Weekly Weekly S&P Stock Market Data

The data sets are immediately available as soon as you issue the command:

library(ISLR)
"" To check issue the command
str(Auto)

No one has ever claimed that R is intuitive :slight_smile:

Powerful, really useful, etc., etc., but not intuitive.

Good luck.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.