# What package to install

#### noetsi

##### Fortran must die
I actually found a package I can use. But when I try to install it I get.

Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file 'C:/PROGRA~1/R/R-33~1.0/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
Line starting '<!DOCTYPE html ...' is malformed!
Warning in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
'lib = "C:/Program Files/R/R-3.3.0/library"' is not writable
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
unable to install packages
InternetOpenUrl failed: ''

If it matters the book about it says
All R examples in the book assume you have loaded the fpp2 package, available on CRAN, using library(fpp2). This will automatically load several other packages including forecast and ggplot2, as well as all the data used in the book. We have used v2.3 of the fpp2 package and v8.12.0.9000 of the forecast package in preparing this book. These can be installed from CRAN in the usual way. Earlier versions of the packages will not necessarily give the same results as those shown in this book.

Last edited:

#### hlsmith

##### Less is more. Stay pure. Stay poor.
For clarificatikn, you got this when running the following:

install.packages( "fpp2")

What happens when you go to say install ggplot package, no issues? And this is on your work machine? I wonder about if it is trying to use an out of US mirror for CRAN and you just need to select another mirror. I havent seen an error like that before.

#### vinux

##### Dark Knight
I am trying to install the necessary packages to run ARIMA for r. It says what package does this (I think) on page 10/11 of the link (this is page 5/6 in the actual book). I can't figure out what package you are supposed to install.

You don't need fpp2 package to run ARIMA. fpp2 mainly contains the datasets (discussed in this book, https://otexts.com/fpp2/).

ARIMA can be done with base packages. forecast package will be a help to automate the time series model.

#### Dason

Code:
Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv');
That makes me think you aren't able to access the internet at all which might be a hurdle in installing any packages easily. You can download them elsewhere and install them using the .zip files though.

#### noetsi

##### Fortran must die
I think the issue is that, since I can access the internet, the CRAN has a foreign connection and my work computer blocks all foreign connections. I tried several US.

I was using Otext thanks vinux. Dason how do you install them through zip files? I have a lot downloaded already, this was not one.

#### staassis

##### Active Member
I think the issue is that, since I can access the internet, the CRAN has a foreign connection and my work computer blocks all foreign connections. I tried several US.
The PA-1 mirror has always worked well for me. I believe it's Pennsylvania.

#### Dason

Obviously Iowa State's mirror is best. If you want to change to that before trying to install and see if that helps just run this line of code before running install.packages
Code:
options(repos = "https://mirror.las.iastate.edu/CRAN/")

#### Dason

Because Iowa State rules. Obviously

(It's where I went to grad school and I actually know the people that run the mirror and they're pretty great)

#### staassis

##### Active Member
It's where I went to grad school and I actually know the people that run the mirror and they're pretty great
Fair enough. Pretty great people go a long way towards something great in life.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I use the IAST mirror often as well in order not to invoke any across state line felonies. I imagine it zonks up to a satellite and right back down to me with little risk of it deviating too far from say the zenith. This is all true right and will hold up in a court of law. But now that the Space Force exists - I may have to re-evaluate my thoughts!

#### noetsi

##### Fortran must die
The problem I think is that the place (on my C drive where the packages were originally stored) can not be written to. It asked me if I wanted to store it in a personal library. When I said yes the packages loaded. Well I thought it had loaded but I got an error message eventually. I printed part of it below. I have a place already where packages are supposed to be downloaded to. How do I tell R to download the package there. And go there when I do a library statement.

Part of the long error message

'\\fldvr.net\hq\users\Rthellein\Desktop'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'prettyunits' ...
** package 'prettyunits' successfully unpacked and MD5 sums checked
** R
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
no library trees found in 'lib.loc'
Execution halted
* removing '\\fldvr.net/hq/Users/rthellein/Documents/R/win-library/3.3/prettyunits'
'\\fldvr.net\hq\users\Rthellein\Desktop'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'rstudioapi' ...
** package 'rstudioapi' successfully unpacked and MD5 sums checked
** R
** inst
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
Warning in file(con, "w") :
cannot open file '\\fldvr.net/hq/Users/rthellein/Documents/R/win-library/3.3/rstudioapi/doc/index.html': No such file or directory
Error in file(con, "w") : cannot open the connection
ERROR: installing vignettes failed
* removing '\\fldvr.net/hq/Users/rthellein/Documents/R/win-library/3.3/rstudioapi'
'\\fldvr.net\hq\users\Rthellein\Desktop'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'evaluate' ...
** package 'evaluate' successfully unpacked and MD5 sums checked
** R
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
there is no package called 'evaluate'
Execution halted

#### noetsi

##### Fortran must die
I did .libPaths and got something I don't understand.

function (new)
{
if (!missing(new)) {
new <- Sys.glob(path.expand(new))
paths <- unique(normalizePath(c(new, .Library.site, .Library),
"/"))
.lib.loc <<- paths[dir.exists(paths)]
}
else .lib.loc
}
<bytecode: 0x00000000143400f0>
<environment: 0x000000001433c058>

#### Dason

You printed the function definition. If you want to call it you need to use parenthesis.

libPaths()

#### noetsi

##### Fortran must die
ok
dason is there a simple way you can change where R install new packages. Also if you have a R package zip file and you want to add it to your system, how do you do that. I have forecast although my version is about 5 years old.

#### Dason

Code:
.libPaths("Directory/you/want/to/use")
will both change where packages are installed to and where they are looked for first.

To view the help file:
Code:
?.libPaths

#### noetsi

##### Fortran must die
I did this
> .libPaths("S:/CIU/RUSTY2/perm")

After doing so without error I did this
> .libPaths()
and got
[1] "S:/CIU/RUSTY2/perm" "C:/Program Files/R/R-3.3.0/library"

the "C:/Program Files/R/R-3.3.0/library" is where it used to be. I need it to not go there because I do not have rights there.

#### Dason

... did you try anything further

#### noetsi

##### Fortran must die
I did what Dason recommended and then tried to install forecast

options(repos = "https://mirror.las.iastate.edu/CRAN/")
> install.packages('forecast')

while it tries to run I get this early on

Installing package into ‘\\fldvr.net/hq/Users/rthellein/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)

I don't understand why lib is unspecified given my post above this.

These are some of the errors I get