Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Install a local development package.

Source:R/install.R
install.Rd

UsesR CMD INSTALL to install the package. Will also try to installdependencies of the package from CRAN, if they're not already installed.

Usage

install(  pkg=".",  reload=TRUE,  quick=FALSE,  build=!quick,  args=getOption("devtools.install.args"),  quiet=FALSE,  dependencies=NA,  upgrade="default",  build_vignettes=FALSE,  keep_source=getOption("keep.source.pkgs"),  force=FALSE,...)

Arguments

pkg

The package to use, can be a file path to the package or apackage object. Seeas.package() for more information.

reload

ifTRUE (the default), will automatically reload thepackage after installing.

quick

ifTRUE skips docs, multiple-architectures,demos, and vignettes, to make installation as fast as possible.

build

ifTRUEpkgbuild::build()s the package first:this ensures that the installation is completely clean, and prevents anybinary artefacts (like.o,.so) from appearing in your localpackage directory, but is considerably slower, because every compile hasto start from scratch.

One downside of installing from a built tarball is that the package isinstalled from a temporary location. This means that any source references,at R level or C/C++ level, will point to dangling locations. The debuggerswill not be able to find the sources for step-debugging. If you'reinstalling the package for development, consider settingbuild toFALSE.

args

An optional character vector of additional command linearguments to be passed toR CMD INSTALL. This defaults to thevalue of the option"devtools.install.args".

quiet

IfTRUE, suppress output.

dependencies

Which dependencies do you want to check?Can be a character vector (selecting from "Depends", "Imports","LinkingTo", "Suggests", or "Enhances"), or a logical vector.

TRUE is shorthand for "Depends", "Imports", "LinkingTo" and"Suggests".NA is shorthand for "Depends", "Imports" and "LinkingTo"and is the default.FALSE is shorthand for no dependencies (i.e.just check this package, not its dependencies).

The value "soft" means the same asTRUE, "hard" means the same asNA.

You can also specify dependencies from one or more additional fields,common ones include:

  • Config/Needs/website - for dependencies used in building the pkgdown site.

  • Config/Needs/coverage for dependencies used in calculating test coverage.

upgrade

Should package dependencies be upgraded? One of "default", "ask", "always", or "never". "default"respects the value of theR_REMOTES_UPGRADE environment variable if set,and falls back to "ask" if unset. "ask" prompts the user for which out ofdate packages to upgrade. For non-interactive sessions "ask" is equivalentto "always".TRUE andFALSE are also accepted and correspond to"always" and "never" respectively.

build_vignettes

ifTRUE, will build vignettes. Normally it isbuild that's responsible for creating vignettes; this argument makessure vignettes are built even if a build never happens (i.e. becausebuild = FALSE).

keep_source

IfTRUE will keep the srcrefs from an installedpackage. This is useful for debugging (especially inside of RStudio).It defaults to the option"keep.source.pkgs".

force

Force installation, even if the remote state has not changedsince the previous install.

...

additional arguments passed toremotes::install_deps()when installing dependencies.

Details

Ifquick = TRUE, installation takes place using the current packagedirectory. If you have compiled code, this means that artefacts ofcompilation will be created in thesrc/ directory. If you want to avoidthis, you can usebuild = TRUE to first build a package bundle and theninstall it from a temporary directory. This is slower, but keeps the sourcedirectory pristine.

If the package is loaded, it will be reloaded after installation. This isnot always completely possible, seereload() for caveats.

To install a package in a non-default library, usewithr::with_libpaths().

See also

update_packages() to update installed packages from thesource location andwith_debug() to install packages withdebugging flags set.

Other package installation:uninstall()


[8]ページ先頭

©2009-2025 Movatter.jp