Movatterモバイル変換


[0]ホーム

URL:


Package 'remotes'

Title:R Package Installation from Remote Repositories, Including'GitHub'
Description:Download and install R packages stored in 'GitHub', 'GitLab', 'Bitbucket', 'Bioconductor', or plain 'subversion' or 'git' repositories. This package provides the 'install_*' functions in 'devtools'. Indeed most of the code was copied over from 'devtools'.
Authors:Gábor Csárdi [aut, cre], Jim Hester [aut], Hadley Wickham [aut], Winston Chang [aut], Martin Morgan [aut], Dan Tenenbaum [aut], Posit Software, PBC [cph, fnd], Ascent Digital Services [cph]
Maintainer:Gábor Csárdi <[email protected]>
License:MIT + file LICENSE
Version:2.5.0.9000
Built:2025-11-20 07:03:10 UTC
Source:https://github.com/r-lib/remotes

Help Index


Download a specified version of a CRAN package

Description

It downloads the package to a temporary file, andreturns the name of the file.

Usage

download_version(  package,  version=NULL,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

package

Name of the package to install.

version

Version of the package to install. Can either be a string giving the exactversion required, or a specification in the same format as the parenthesized expressions usedin package dependencies. One of the following formats:

  • An exact version required, as a string, e.g."0.1.13"

  • A comparison operator and a version, e.g.">= 0.1.12"

  • Several criteria to satisfy, as a comma-separated string, e.g.">= 1.12.0, < 1.14"

  • Several criteria to satisfy, as elements of a character vector, e.g.c(">= 1.12.0", "< 1.14")

repos

character vector, the base URL(s) of the repositoriesto use, e.g., the URL of a CRAN mirror such as"https://cloud.r-project.org". For more details onsupported URL schemes seeurl.

Can beNULL to install from local files, directories or URLs:this will be inferred by extension frompkgs if of length one.

type

character, indicating the type of package to download andinstall. Will be"source" except on Windows and some macOSbuilds: see the section on ‘Binary packages’ for those.

...

Other arguments passed on toutils::install.packages().

Value

Name of the downloaded file.


GitHub references

Description

Use asref parameter toinstall_github().Allows installing a specific pull request or the latest release.

Usage

github_pull(pull)github_release()

Arguments

pull

Character string specifying the pull request to install

See Also

install_github()

Examples

github_pull("42")

Install a development package from the Bioconductor git repository

Description

This function requiresgit to be installed on your system in order tobe used.

Usage

install_bioc(  repo,  mirror= getOption("BioC_git", download_url("git.bioconductor.org/packages")),  git= c("auto","git2r","external"),  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

repo

Repository address in the format⁠[username:password@][release/]repo[#commit]⁠. Valid values forthe release are ‘devel’,‘release’ (the default if none specified), or numeric releasenumbers (e.g. ‘3.3’).

mirror

The Bioconductor git mirror to use

git

Whether to use thegit2r package, or an externalgit client via system. Default isgit2r if it is installed,otherwise an external git installation.

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

Details

It is vectorised so you can install multiple packages witha single command.

This is intended as an aid for Bioconductor developers. If you want toinstall the release version of a Bioconductor package one can use theBiocManager package.

See Also

Other package installation:install_bitbucket(),install_cran(),install_dev(),install_github(),install_gitlab(),install_git(),install_local(),install_svn(),install_url(),install_version()

Examples

## Not run:install_bioc("SummarizedExperiment")install_bioc("devel/SummarizedExperiment")install_bioc("3.3/SummarizedExperiment")install_bioc("SummarizedExperiment#abc123")install_bioc("user:password@release/SummarizedExperiment")install_bioc("user:password@devel/SummarizedExperiment")install_bioc("user:password@SummarizedExperiment#abc123")## End(Not run)

Install a package directly from Bitbucket

Description

This function is vectorised so you can install multiple packages ina single command.

Usage

install_bitbucket(  repo,  ref="HEAD",  subdir=NULL,  auth_user= bitbucket_user(),  password= bitbucket_password(),  host="api.bitbucket.org/2.0",  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

repo

Repository address in the format⁠username/repo[/subdir][@ref]⁠. Alternatively, you canspecifysubdir and/orref using the respective parameters(see below); if both are specified, the values inrepo takeprecedence.

ref

Desired git reference; could be a commit, tag, or branch name.Defaults to HEAD.

subdir

Subdirectory within repo that contains the R package.

auth_user

your account username if you're attempting to installa package hosted in a private repository (and your username is differenttousername). Defaults to theBITBUCKET_USER environmentvariable.

password

your password. Defaults to theBITBUCKET_PASSWORDenvironment variable. See details for further information on settingup a password.

host

GitHub API host to use. Override with your GitHub enterprisehostname, for example,"github.hostname.com/api/v3".

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

Details

To install from a private repo, or more generally, access theBitbucket API with your own credentials, you will need to get an accesstoken. You can create an access token following the instructions found intheBitbucketApp Passwords documentation. The App Password requires read-only access toyour repositories and pull requests. Then store your password in theenvironment variableBITBUCKET_PASSWORD (e.g.evelynwaugh:swordofhonour)

Note that on Windows, authentication requires the "libcurl" downloadmethod. You can set the default download method via thedownload.file.method option:

options(download.file.method = "libcurl")

In particular, if unset, RStudio sets the download method to "wininet".To override this, you might want to set it to "libcurl" in yourR profile, seebase::Startup. The caveat of the "libcurl" method isthat it doesnot set the system proxies automatically, see"Setting Proxies" inutils::download.file().

See Also

Bitbucket API docs:https://confluence.atlassian.com/bitbucket/use-the-bitbucket-cloud-rest-apis-222724129.html

Other package installation:install_bioc(),install_cran(),install_dev(),install_github(),install_gitlab(),install_git(),install_local(),install_svn(),install_url(),install_version()

Examples

## Not run:install_bitbucket("sulab/mygene.r@default")install_bitbucket("djnavarro/lsr")## End(Not run)

Attempts to install a package from CRAN.

Description

This function is vectorised onpkgs so you can install multiplepackages in a single command.

Usage

install_cran(  pkgs,  repos= getOption("repos"),  type= getOption("pkgType"),  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,...)

Arguments

pkgs

A character vector of packages to install.

repos

A character vector giving repositories to use.

type

Type of package toupdate.

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

...

Other arguments passed on toutils::install.packages().

See Also

Other package installation:install_bioc(),install_bitbucket(),install_dev(),install_github(),install_gitlab(),install_git(),install_local(),install_svn(),install_url(),install_version()

Examples

## Not run:install_cran("ggplot2")install_cran(c("httpuv","shiny"))## End(Not run)

Install package dependencies if needed.

Description

Install package dependencies if needed.

Usage

install_deps(  pkgdir=".",  dependencies=NA,  repos= getOption("repos"),  type= getOption("pkgType"),  upgrade= c("default","ask","always","never"),  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,...)

Arguments

pkgdir

Path to a package directory, or to a package tarball.

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.

repos

A character vector giving repositories to use.

type

Type of package toupdate.

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.

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

...

additional arguments passed toutils::install.packages().

Examples

## Not run: install_deps(".")

Install the development version of a package

Description

install_dev() retrieves the package DESCRIPTION from the CRAN mirror andlooks in the 'URL' and 'BugReports' fields for GitHub, GitLab or BitbucketURLs. It then calls the appropriateinstall_() function to install thedevelopment package.

Usage

install_dev(package, cran_url= getOption("repos")[["CRAN"]],...)

Arguments

package

The package name to install.

cran_url

The URL of the CRAN mirror to use, by default based on the'repos' option. If unset uses 'https://cloud.r-project.org'.

...

Additional arguments passed toinstall_github(),install_gitlab(), orinstall_bitbucket() functions.

See Also

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_github(),install_gitlab(),install_git(),install_local(),install_svn(),install_url(),install_version()

Examples

## Not run:# From GitHubinstall_dev("dplyr")# From GitLabinstall_dev("iemiscdata")# From Bitbucketinstall_dev("argparser")## End(Not run)

Install a package from a git repository

Description

It is vectorised so you can install multiple packages witha single command. You do not need to have thegit2r package,or an external git client installed.

Usage

install_git(  url,  subdir=NULL,  ref=NULL,  branch=NULL,  credentials= git_credentials(),  git= c("auto","git2r","external"),  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

url

Location of package. The url should point to a public orprivate repository.

subdir

A sub-directory within a git repository that maycontain the package we are interested in installing.

ref

Name of branch, tag or SHA reference to use, if not HEAD.

branch

Deprecated, synonym for ref.

credentials

A git2r credentials object passed through to clone.Supplying this argument implies usinggit2r withgit.

git

Whether to use thegit2r package, or an externalgit client via system. Default isgit2r if it is installed,otherwise an external git installation.

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

Details

If you need to set git credentials for use in theRemotes field you can doso by placing the credentials in theremotes.git_credentials globaloption.

See Also

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_dev(),install_github(),install_gitlab(),install_local(),install_svn(),install_url(),install_version()

Examples

## Not run:install_git("https://github.com/hadley/stringr.git")install_git("https://github.com/hadley/stringr.git", ref="stringr-0.2")## End(Not run)

Attempts to install a package directly from GitHub.

Description

This function is vectorised onrepo so you can install multiplepackages in a single command.

Usage

install_github(  repo,  ref="HEAD",  subdir=NULL,  auth_token= github_pat(quiet),  host="api.github.com",  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

repo

Repository address in the format⁠username/repo[/subdir][@ref|#pull|@*release]⁠. Alternatively, you canspecifysubdir and/orref using the respective parameters(see below); if both are specified, the values inrepo takeprecedence.

ref

Desired git reference. Could be a commit, tag, or branchname, or a call togithub_pull() orgithub_release(). Defaults to"HEAD", which means the default branch on GitHub and for git remotes.Seesetting-the-default-branchfor more details.

subdir

Subdirectory within repo that contains the R package.

auth_token

To install from a private repo, generate a personalaccess token (PAT) with at least repo scope inhttps://github.com/settings/tokens andsupply to this argument. This is safer than using a password becauseyou can easily delete a PAT without affecting any others. Defaults totheGITHUB_PAT environment variable.

host

GitHub API host to use. Override with your GitHub enterprisehostname, for example,"github.hostname.com/api/v3".

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

Details

If the repository uses submodules a command-line git client is required toclone the submodules.

See Also

github_pull()

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_dev(),install_gitlab(),install_git(),install_local(),install_svn(),install_url(),install_version()

Examples

## Not run:install_github("klutometis/roxygen")install_github("wch/ggplot2", ref= github_pull("142"))install_github(c("rstudio/httpuv","rstudio/shiny"))install_github(c("hadley/[email protected]","klutometis/roxygen#142","r-lib/roxygen2@*release","mfrasca/r-logging/pkg"))# To install from a private repo, use auth_token with a token# from https://github.com/settings/tokens. You only need the# repo scope. Best practice is to save your PAT in env var called# GITHUB_PAT.install_github("hadley/private", auth_token="abc")# To pass option arguments to `R CMD INSTALL` use `INSTALL_opts`. e.g. toinstall a package with source references and testsinstall_github("rstudio/shiny", INSTALL_opts= c("--with-keep.source","--install-tests"))## End(Not run)

Install a package from GitLab

Description

This function is vectorised onrepo so you can install multiplepackages in a single command. Like other remotes the repository will skipinstallation ifforce == FALSE (the default) and the remote state hasnot changed since the previous installation.

Usage

install_gitlab(  repo,  subdir=NULL,  auth_token= gitlab_pat(quiet),  host="gitlab.com",  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

repo

Repository address in the format⁠username/repo[@ref]⁠.

subdir

Subdirectory within repo that contains the R package.

auth_token

To install from a private repo, generate a personal accesstoken (PAT) with at least read_api scope inhttps://docs.gitlab.com/ee/user/profile/personal_access_tokens.html andsupply to this argument. This is safer than using a password because youcan easily delete a PAT without affecting any others. Defaults to theGITLAB_PAT environment variable.

host

GitLab API host to use. Override with your GitLab enterprisehostname, for example,"<PROTOCOL://>gitlab.hostname.com".The PROTOCOL is required by packrat during Posit Connect deployment. Whileinstall_gitlab may work without, omitting it generallyleads to package restoration errors.

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

See Also

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_dev(),install_github(),install_git(),install_local(),install_svn(),install_url(),install_version()

Examples

## Not run:install_gitlab("jimhester/covr")## End(Not run)

Install a package from a local file

Description

This function is vectorised so you can install multiple packages ina single command.

Usage

install_local(  path=".",  subdir=NULL,  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=!is_binary_pkg(path),  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

path

path to local directory, or compressed file (tar, zip, tar.gztar.bz2, tgz2 or tbz)

subdir

subdirectory within url bundle that contains the R package.

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

See Also

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_dev(),install_github(),install_gitlab(),install_git(),install_svn(),install_url(),install_version()

Examples

## Not run:dir<- tempfile()dir.create(dir)pkg<- download.packages("testthat", dir, type="source")install_local(pkg[,2])## End(Not run)

Install a package from a SVN repository

Description

This function requiressvn to be installed on your system in order tobe used.

Usage

install_svn(  url,  subdir=NULL,  args= character(0),  revision=NULL,  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

url

Location of package. The url should point to a public orprivate repository.

subdir

A sub-directory within a svn repository that contains thepackage we are interested in installing.

args

A character vector providing extra options to pass on tosvn.

revision

svn revision, if omitted updates to latest

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

Details

It is vectorised so you can install multiple packages witha single command.

See Also

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_dev(),install_github(),install_gitlab(),install_git(),install_local(),install_url(),install_version()

Examples

## Not run:install_svn("https://github.com/hadley/stringr/trunk")install_svn("https://github.com/hadley/httr/branches/oauth")## End(Not run)

Install a package from a url

Description

This function is vectorised so you can install multiple packages ina single command.

Usage

install_url(  url,  subdir=NULL,  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

url

location of package on internet. The url should point to azip file, a tar file or a bzipped/gzipped tar file.

subdir

subdirectory within url bundle that contains the R package.

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

See Also

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_dev(),install_github(),install_gitlab(),install_git(),install_local(),install_svn(),install_version()

Examples

## Not run:install_url("https://github.com/hadley/stringr/archive/HEAD.zip")## End(Not run)

Install specific version of a package.

Description

This function knows how to look in multiple CRAN-like package repositories, and in theirarchive directories, in order to find specific versions of the requested package.

Usage

install_version(  package,  version=NULL,  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=FALSE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type="source",...)

Arguments

package

Name of the package to install.

version

Version of the package to install. Can either be a string giving the exactversion required, or a specification in the same format as the parenthesized expressions usedin package dependencies. One of the following formats:

  • An exact version required, as a string, e.g."0.1.13"

  • A comparison operator and a version, e.g.">= 0.1.12"

  • Several criteria to satisfy, as a comma-separated string, e.g.">= 1.12.0, < 1.14"

  • Several criteria to satisfy, as elements of a character vector, e.g.c(">= 1.12.0", "< 1.14")

dependencies

logical indicating whether to also installuninstalled packages which these packages depend on/linkto/import/suggest (and so on recursively).Not used ifrepos = NULL.Can also be a character vector, a subset ofc("Depends", "Imports", "LinkingTo", "Suggests", "Enhances").

Only supported iflib is of length one (or missing),so it is unambiguous where to install the dependent packages. Ifthis is not the case it is ignored, with a warning.

The default,NA, meansc("Depends", "Imports", "LinkingTo").

TRUE means to usec("Depends", "Imports", "LinkingTo", "Suggests") forpkgs andc("Depends", "Imports", "LinkingTo") for added dependencies:this installs all the packages needed to runpkgs, theirexamples, tests and vignettes (if the package author specified themcorrectly).

In all of these,"LinkingTo" is omitted for binary packages.

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.

force

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

quiet

logical: if true, reduce the amount of output. This isnotpassed toavailable.packages() in case that is called, onpurpose.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

character vector, the base URL(s) of the repositoriesto use, e.g., the URL of a CRAN mirror such as"https://cloud.r-project.org". For more details onsupported URL schemes seeurl.

Can beNULL to install from local files, directories or URLs:this will be inferred by extension frompkgs if of length one.

type

character, indicating the type of package to download andinstall. Will be"source" except on Windows and some macOSbuilds: see the section on ‘Binary packages’ for those.

...

Other arguments passed on toutils::install.packages().

Details

The repositories are searched in the order specified by therepos argument. This enablesteams to maintain multiple in-house repositories with different policies - for instance, one repofor development snapshots and one for official releases. A common setup would be to first searchthe official release repo, then the dev snapshot repo, then a public CRAN mirror.

Older versions of packages on CRAN are usually only available in source form. If your requestedpackage contains compiled code, you will need to have an R development environment installed. Youcan check if you do by runningdevtools::has_devel (you need thedevtools package for this).

See Also

Other package installation:install_bioc(),install_bitbucket(),install_cran(),install_dev(),install_github(),install_gitlab(),install_git(),install_local(),install_svn(),install_url()

Examples

## Not run:install_version("devtools","1.11.0")install_version("devtools",">= 1.12.0, < 1.14")## Specify search order (e.g. in ~/.Rprofile)options(repos= c(  prod="http://mycompany.example.com/r-repo",  dev="http://mycompany.example.com/r-repo-dev",  CRAN="https://cran.revolutionanalytics.com"))install_version("mypackage","1.15")# finds in 'prod'install_version("mypackage","1.16-39487")# finds in 'dev'## End(Not run)

Find all dependencies of a CRAN or dev package.

Description

Find all the dependencies of a package and determine whether they are aheador behind CRAN. Aprint() method identifies mismatches (if any)between local and CRAN versions of each dependent package; anupdate() method installs outdated or missing packages from CRAN.

Usage

package_deps(  packages,  dependencies=NA,  repos= getOption("repos"),  type= getOption("pkgType"))local_package_deps(pkgdir=".", dependencies=NA)dev_package_deps(  pkgdir=".",  dependencies=NA,  repos= getOption("repos"),  type= getOption("pkgType"),  remote_precedence=TRUE,  additional_repositories=TRUE)## S3 method for class 'package_deps'update(  object,  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

packages

A character vector of package names.

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.

repos

A character vector giving repositories to use.

type

Type of package toupdate.

pkgdir

Path to a package directory, or to a package tarball.

remote_precedence

A logical flag specifying whether remote sources should take precedence overCRAN when both were found.

additional_repositories

A logical flag specifying whetherAdditional_repositories shouldbe extracted from the DESCRIPTION and appended torepos.

object

Apackage_deps object.

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.

force

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

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

...

Additional arguments passed toinstall_packages.

Value

Adata.frame with columns:

package The dependent package's name,
installed The currently installed version,
available The version available on CRAN,
diff An integer denoting whether the locally installed versionof the package is newer (1), the same (0) or older (-1) than the versioncurrently available on CRAN.

Examples

## Not run:package_deps("devtools")# Use update to update any out-of-date dependenciesupdate(package_deps("devtools"))## End(Not run)

Parse a remote git repo specification

Description

A remote repo can be specified in two ways:

as a URL

parse_github_url() handles HTTPS and SSH remote URLsand various GitHub browser URLs

via a shorthand

parse_repo_spec() handles this concise form:⁠[username/]repo[/subdir][#pull|@ref|@*release]⁠

Usage

parse_repo_spec(repo)parse_github_repo_spec(repo)parse_github_url(repo)

Arguments

repo

Character scalar, the repo specification.

Value

List with members:username,repo,subdirref,pull,release, some which will be empty.

Examples

parse_repo_spec("metacran/crandb")parse_repo_spec("jimhester/covr#47")## pull requestparse_repo_spec("jeroen/[email protected]")## specific tagparse_repo_spec("tidyverse/dplyr@*release")## shorthand for latest releaseparse_repo_spec("r-lib/remotes@550a3c7d3f9e1493a2ba")## commit SHAparse_repo_spec("igraph=igraph/rigraph")## Different package name from repo nameparse_github_url("https://github.com/jeroen/curl.git")parse_github_url("[email protected]:metacran/crandb.git")parse_github_url("https://github.com/jimhester/covr")parse_github_url("https://github.example.com/user/repo.git")parse_github_url("[email protected]:user/repo.git")parse_github_url("https://github.com/r-lib/remotes/pull/108")parse_github_url("https://github.com/r-lib/remotes/tree/name-of-branch")parse_github_url("https://github.com/r-lib/remotes/commit/1234567")parse_github_url("https://github.com/r-lib/remotes/releases/latest")parse_github_url("https://github.com/r-lib/remotes/releases/tag/1.0.0")

Query the system requirements for a package (and its dependencies)

Description

Returns a character vector of commands to run that will install systemrequirements for the queried operating system.

Usage

system_requirements(  os,  os_release=NULL,  path=".",  package=NULL,  curl= Sys.which("curl"))

Arguments

os,os_release

The operating system and operating system release version, seehttps://github.com/rstudio/r-system-requirements#operating-systems for thelist of supported operating systems.

Ifos_release isNULL,os must consist of the operating systemand the version separated by a dash, e.g."ubuntu-18.04".

path

The path to the dev package's root directory.

package

CRAN package name(s) to lookup system requirements for. If notNULL, this is used andpath is ignored.

curl

The location of the curl binary on your system.

Value

A character vector of commands needed to install the system requirements for the package.


Update packages that are missing or out-of-date.

Description

Works similarly toutils::install.packages() but doesn't install packagesthat are already installed, and also upgrades out dated dependencies.

Usage

update_packages(  packages=TRUE,  dependencies=NA,  upgrade= c("default","ask","always","never"),  force=FALSE,  quiet=FALSE,  build=TRUE,  build_opts= c("--no-resave-data","--no-manual","--no-build-vignettes"),  build_manual=FALSE,  build_vignettes=FALSE,  repos= getOption("repos"),  type= getOption("pkgType"),...)

Arguments

packages

Character vector of packages to update.

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.

force

Deprecated, this argument has no effect.

quiet

IfTRUE, suppress output.

build

IfTRUE build the package before installing.

build_opts

Options to pass to⁠R CMD build⁠, only used whenbuild isTRUE.

build_manual

IfFALSE, don't build PDF manual ('–no-manual').

build_vignettes

IfFALSE, don't build package vignettes ('–no-build-vignettes').

repos

A character vector giving repositories to use.

type

Type of package toupdate.

...

Other arguments passed on toutils::install.packages().

See Also

package_deps() to see which packages are out of date/missing.

Examples

## Not run:update_packages("ggplot2")update_packages(c("plyr","ggplot2"))## End(Not run)


[8]ページ先頭

©2009-2025 Movatter.jp