run_R_CMD: Run 'R CMD'

Description Usage Arguments Details Value See Also Examples

View source: R/package.R

Description

Externally call R CMD, e.g. for checking or installing R packages, or conduct some postprocessing after checking or installation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  run_R_CMD(x, ...)

  ## S3 method for class 'character'
 run_R_CMD(x, what = "check", ...,
    sudo = identical(what, "INSTALL"),
    system.args = list())

  copy_pkg_files(x, ...)

  ## S3 method for class 'character'
 copy_pkg_files(x, what = "scripts",
    to = file.path(Sys.getenv("HOME"), "bin"),
    installed = TRUE, ignore = NULL, overwrite = TRUE, ...)

  delete_o_files(x, ...)

  ## S3 method for class 'character'
 delete_o_files(x, ext = "o",
    ignore = NULL, ...)

Arguments

x

For run_R_CMD, a character vector with arguments passed to R CMD <what>. If these are the names of one to several package directories, the package name alone does not suffice unless the package is a subdirectory of the working directory.

For copy_pkg_files and delete_o_files, a character vector passed as eponymous argument to pkg_files.

what

Character scalar with the name of the command used by R CMD, or (for copy_pkg_files) a character vector with the names of subdirectories to copy.

sudo

Logical scalar. Prepend a sudo call to the command? Probably makes only sense on UNIX-like systems.

system.args

Optional list of arguments passed to system from the base package.

to

Character vector indicating the target folder(s) or file(s).

overwrite

Logical scalar passed to file.copy from the base package (in addition to from and to).

ext

Character vector with file extensions to consider. Need not contain the leading dot. Content of .Platform$dynlib.ext is added automatically.

...

For run_R_CMD, optional command-line switches passed to R CMD <what>. In contrast to x, leading dashes are automatically prepended as necessary. For copy_pkg_files, optional arguments passed to file.copy from the base package.

installed

Logical scalar. If TRUE, the package(s) are searched using find.package. Otherwise pkg is treated as list of directories and/or file names, distinguished using is_pkg_dir.

ignore

NULL or a character vector of file names (without their directory-name parts) to remove from the result, or a list. Ignored if empty. If a non-empty character vector, matching is done case- insensitively. If a list, used as arguments passed to grep (except for x, value and invert). Enclosing ignore in I() reverts the action.

Details

Windows users might need to install Rtools for run_R_CMD to work, see https://cran.r-project.org/bin/windows/Rtools/.

copy_pkg_files copies package files after installation. This is mainly intended for script files, which should often be placed in a directory for executable files. The docu.R and merge.R scripts that come with the pkgutils package are examples for such files.

delete_o_files removes object files in the ‘src’ subdirectory of a package remaining from previous compilation attempts, if any.

Value

The return value of run_R_CMD is the one of the call of R CMD, depending on system.args, by default an integer indicating success or failure.

copy_pkg_files returns a logical vector. See file.copy from the base package for details.

delete_o_files also returns a logical vector, this time indicating whether deletion succeeded. See file.remove from the base package.

See Also

base::system base::file.copy base::file.remove

Other package-functions: check_R_code, check_Sweave_start, is_pkg_dir, logfile, pack_desc, pkg_files, swap_code,

Examples

1
2
3
4
5
6
7
8
# Running R CMD <what>: see the 'docu.R' script provided with this package,
# options '--check', # '--install' and '--yes'.

# Copying files: see the 'docu.R' script provided with this package, options
# '--target' and '--exclude'.

# Deleting object files: see the 'docu.R' script provided with this package,
# option '--zapoff'.

pkgutils documentation built on May 2, 2019, 5:49 p.m.

Related to run_R_CMD in pkgutils...