Created on 03-22-2018 07:07 PM
Step-by-step instructions on how-to install a CRAN package from a local repo - without an internet connection.
I'll be installing the package called "tidyr". In order to fully install the package, I need to first download tidyr and all dependencies. To do this, I use the CRAN PACKAGE:
https://cran.r-project.org/src/contrib/PACKAGES
1) Finding "Package: tidyr", I can see the dependencies (imports):
Imports: dplyr (>= 0.7.0), glue, magrittr, purrr, Rcpp, rlang, stringi,
tibble, tidyselect
and from them, I can build a list of all the imported packages I need:
2) Download the packages from https://cran.r-project.org/src/contrib/
3) Create a directory to emulate the CRAN repo, in my example I created /tmp/ryantester/src/contrib
4) Create a PACKAGES file within /tmp/ryantester/src/contrib - since this tutorial covers tidyr, I'll include the necessary packages
Package: R6
Version: 2.2.2
Depends: R (>= 3.0)
Suggests: knitr, microbenchmark, pryr, testthat, ggplot2, scales
License: MIT + file LICENSE
NeedsCompilation: no
Package: pkgconfig
Version: 2.0.1
Imports: utils
Suggests: covr, testthat, disposables (>= 1.0.3)
License: MIT + file LICENSE
NeedsCompilation: no
Package: bindr
Version: 0.1.1
Suggests: testthat
License: MIT + file LICENSE
NeedsCompilation: no
Package: bindrcpp
Version: 0.2
Imports: Rcpp, bindr
LinkingTo: Rcpp, plogr
Suggests: testthat
License: MIT + file LICENSE
NeedsCompilation: yes
Package: plogr
Version: 0.1-1
Suggests: Rcpp
License: MIT + file LICENSE
NeedsCompilation: no
Package: BH
Version: 1.66.0-1
License: BSL-1.0
NeedsCompilation: no
Package: plogr
Version: 0.1-1
Suggests: Rcpp
License: MIT + file LICENSE
NeedsCompilation: no
Package: dplyr
Version: 0.7.4
Depends: R (>= 3.1.2)
Imports: assertthat, bindrcpp (>= 0.2), glue (>= 1.1.1), magrittr,
methods, pkgconfig, rlang (>= 0.1.2), R6, Rcpp (>= 0.12.7),
tibble (>= 1.3.1), utils
LinkingTo: Rcpp (>= 0.12.0), BH (>= 1.58.0-1), bindrcpp, plogr
Suggests: bit64, covr, dbplyr, dtplyr, DBI, ggplot2, hms, knitr, Lahman
(>= 3.0-1), mgcv, microbenchmark, nycflights13, rmarkdown,
RMySQL, RPostgreSQL, RSQLite, testthat, withr
License: MIT + file LICENSE
NeedsCompilation: yes
Package: utf8
Version: 1.1.3
Depends: R (>= 2.10)
Suggests: corpus, knitr, rmarkdown, testthat
License: Apache License (== 2.0) | file LICENSE
NeedsCompilation: yes
Package: assertthat
Version: 0.2.0
Imports: tools
Suggests: testthat
License: GPL-3
NeedsCompilation: no
Package: cli
Version: 1.0.0
Depends: R (>= 2.10)
Imports: assertthat, crayon, methods
Suggests: covr, mockery, testthat, withr
License: MIT + file LICENSE
NeedsCompilation: no
Package: crayon
Version: 1.3.4
Imports: grDevices, methods, utils
Suggests: mockery, rstudioapi, testthat, withr
License: MIT + file LICENSE
NeedsCompilation: no
Package: pillar
Version: 1.2.1
Imports: cli (>= 1.0.0), crayon (>= 1.3.4), methods, rlang (>= 0.2.0),
utf8 (>= 1.1.3)
Suggests: knitr (>= 1.19), lubridate, testthat (>= 2.0.0)
License: GPL-3
NeedsCompilation: no
Package: tidyselect
Version: 0.2.4
Depends: R (>= 3.1)
Imports: glue, purrr, rlang (>= 0.2.0), Rcpp (>= 0.12.0)
LinkingTo: Rcpp (>= 0.12.0),
Suggests: covr, dplyr, testthat
License: GPL-3
NeedsCompilation: yes
Package: tibble
Version: 1.4.2
Depends: R (>= 3.1.0)
Imports: cli, crayon, methods, pillar (>= 1.1.0), rlang, utils
Suggests: covr, dplyr, import, knitr (>= 1.5.32), microbenchmark,
mockr, nycflights13, rmarkdown, testthat, withr
License: MIT + file LICENSE
NeedsCompilation: yes
Package: stringi
Version: 1.1.7
Depends: R (>= 2.14)
Imports: tools, utils, stats
License: file LICENSE
License_is_FOSS: yes
NeedsCompilation: yes
Package: rlang
Version: 0.2.0
Depends: R (>= 3.1.0)
Suggests: crayon, knitr, methods, pillar, rmarkdown (>= 0.2.65),
testthat, covr
License: GPL-3
NeedsCompilation: yes
Package: Rcpp
Version: 0.12.16
Depends: R (>= 3.0.0)
Imports: methods, utils
Suggests: RUnit, inline, rbenchmark, knitr, rmarkdown, pinp, pkgKitten
(>= 0.1.2)
License: GPL (>= 2)
NeedsCompilation: yes
Package: purrr
Version: 0.2.4
Depends: R (>= 3.1)
Imports: magrittr (>= 1.5), rlang (>= 0.1), tibble
Suggests: covr, dplyr (>= 0.4.3), knitr, rmarkdown, testthat
License: GPL-3 | file LICENSE
NeedsCompilation: yes
Package: magrittr
Version: 1.5
Suggests: testthat, knitr
License: MIT + file LICENSE
NeedsCompilation: no
Package: glue
Version: 1.2.0
Depends: R (>= 3.1)
Imports: methods
Suggests: testthat, covr, magrittr, crayon, knitr, rmarkdown, DBI,
RSQLite, R.utils, forcats, microbenchmark, rprintf, stringr,
ggplot2
License: MIT + file LICENSE
NeedsCompilation: yes
Package: tidyr
Version: 0.8.0
Depends: R (>= 3.2)
Imports: dplyr (>= 0.7.0), glue, magrittr, purrr, Rcpp, rlang, stringi,
tibble, tidyselect
LinkingTo: Rcpp
Suggests: covr, gapminder, knitr, rmarkdown, testthat
License: MIT + file LICENSE
NeedsCompilation: yes
5) Move the downloaded packages from #1 and #2 to the /tmp/ryantester/src/contrib
6) The final step is to install, pointing to your local repo (in our case, /tmp/ryantester)
install.packages('tidyr', repos = "file:///tmp/ryantester")
Created on 07-19-2018 01:54 PM
I have followed the above steps
keep getting the following error
install.packages("magrittr", repos = "/tmp/r-packages/")
Installing package into ‘/usr/lib64/R/library’ (as ‘lib’ is unspecified)
Warning message: package ‘magrittr’ is not available (for R version 3.4.1)
Created on 07-19-2018 02:51 PM
Never mind it works ,if add empty line between every package in PACKAGES file
Created on 11-19-2018 03:23 PM
What kind of extension should have PACKAGES file?