R.Ax
R.Ax

Reputation: 9

Installing ggplot2 in R without being connected to the Internet

I tried to install the package ggplot2 on my computer with the command line:

install.packages("C:/r-packages/ggplot2",repos = NULL,type = "sourse")

Unfortunately I got the following error:

* installing *source* package 'ggplot2' ...
** package 'ggplot2' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
object 'vI' not found
ERROR: lazy loading failed for package 'ggplot2'
* removing 'C:/Users/rachel/Documents/R/win-library/3.3/ggplot2'
 Warning in install.packages :
 running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" CMD INSTALL -l
   "C:\Users\rachel\Documents\R\win-library\3.3" "C:/r-packages/ggplot2"' had      status 1
Warning in install.packages :
installation of package ‘C:/r-packages/ggplot2’ had non-zero exit status

I don't have a connection to the internet so I can't download the package directly (This is why the repos=NULL). I also installed Rtools, but I still face the same problem. The same error appears when I am trying to install the packages car or devtools

 sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server >= 2012 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United    States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Rcpp_0.12.6

loaded via a namespace (and not attached):
[1] tools_3.3.1

Upvotes: 0

Views: 1058

Answers (1)

jimjamslam
jimjamslam

Reputation: 2067

You don't need to unzip the source file that you download from CRAN (make sure it is the source, too: you want the one labelled 'Package source'). So if you're installing from source and have downloaded to your typical Downloads folder, I'd expect it to look like this:

install.packages("C:/Users/rachel/Downloads/ggplot2_2.1.0.tar.gz")

(The repos argument is inferred if you're only installing one package at a time, and type defaults to source. You misspelt source in your example, but I don't think that's a problem because of the default.)

You could also download the Windows binary, which comes as a ZIP file, and install that in a similar way:

install.packages("C:/Users/rachel/Downloads/ggplot2_2.1.0.zip", type = 'win.binary')

Upvotes: 2

Related Questions