Learn R Programming

RWsearch (version 4.7.0)

p_down: Download the Package Documentation in One Directory or in Several Subdirectories

Description

If pkgs is a vector of packages obtained from s_crandb, p_down downloads from CRAN and saves in the dir directory (by default the current directory) the index page, the manual, the vignettes, the README, NEWS, ChangeLog, CRAN checks files, the source code in pkg_ver.tar.gz format, the binary code in pkg_ver.tgz (Mac OSX) or pkg_ver.zip (Windows) format and a minimal R-script of each package. The files that do not exist are ignored, with no warning.

If pkgs is a list of packages obtained from s_crandb_list, p_down saves the downloaded files in subdirectories named after the names of the list, e.g. the keywords used at the search step. The names are eventually modified with gsub(".", "_", make.names(pkg), fixed = TRUE) to cope with Unix and Windows directory names.

p_down0 calls p_down with different values for each argument. With the default configuration, this function downloads nothing. It is mostly used to download one specific item which has not been previously downloaded.

Visit p_downarch to download tar.gz file(s) from CRAN archive.

Usage

p_down(..., char = NULL, index = TRUE, manual = TRUE,
  vignettes = TRUE, README = TRUE, NEWS = FALSE, ChangeLog = FALSE,
  checks = FALSE, targz = FALSE, binary = FALSE, type = "binary",
  script = FALSE, dir = ".", crandb = get("crandb", envir =
  .GlobalEnv), repos = getOption("repos")[1])

p_down0(..., char = NULL, index = FALSE, manual = FALSE, vignettes = FALSE, README = FALSE, NEWS = FALSE, ChangeLog = FALSE, checks = FALSE, targz = FALSE, binary = FALSE, type = "binary", script = FALSE, dir = ".", crandb = get("crandb", envir = .GlobalEnv), repos = getOption("repos")[1])

Arguments

...

any format recognized by cnsc, including list. A vector or packages or a named list of packages (with names being the keywords).

char

(name to) a character vector or a list. Use this argument if ... fails or if you call the function from another function. If used, argument ... is ignored.

index

logical. Download the html index page of each package.

manual

logical. Download the pdf manual.

vignettes

logical. Download the html and pdf vignettes, if they exist.

README

logical. Download the README file, if it exists.

NEWS

logical. Download the NEWS file, if it exists.

ChangeLog

logical. Download the ChangeLog file, if it exists.

checks

logical. Download the CRAN checks file.

targz

logical. Download the *.tar.gz source file.

binary

logical. Download the *.tgz (Mac OSX) or *.zip (Windows) binary file, depending the type value.

type

character. Either "mac.binary", "mac.binary.el-capitan", or "win.binary". "binary" seems also accepted. See the type section of utils::install.packages.

script

logical. Create a mini-script to test the package.

dir

character. The directory in which the files are saved. Default value "." is the current directory.

crandb

data.frame crandb. The data.frame of CRAN packages.

repos

character. The address of your local CRAN.

Examples

Run this code
# NOT RUN {
## In real life, download crandb from CRAN or load it from your directory 
## with functions crandb_down() or crandb_load(). 
## In this example, we use a small file.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))
# }
# NOT RUN {
## Download the documentation in the "dirpkgs" directory. Flat representation.
p_down(pacman, pdfsearch, sos, dir = "dirpkgs", repos = "https://cloud.r-project.org")

## Download the documentation in subdirectories named after the keywords.
(lst <- s_crandb_list(thermodynamic, "chemical reaction"))
p_down(lst, dir = "dirpkgslist", repos = "https://cloud.r-project.org") 
# }

Run the code above in your browser using DataLab