Package 'ipkg'

Title: Install R Packages or Download File from GitHub via the Proxy Site
Description: When you want to install R package or download file from GitHub, but you can't access GitHub, this package helps you install R packages or download file from GitHub via the proxy website <https://mirror.ghproxy.com/> or <https://gh-proxy.com/>, which is in real-time sync with GitHub.
Authors: Xinyuan Chu [aut, cre]
Maintainer: Xinyuan Chu <[email protected]>
License: MIT + file LICENSE
Version: 1.1.1
Built: 2024-11-02 03:11:38 UTC
Source: https://gitlab.com/chuxinyuan/ipkg

Help Index


Tests whether the website is properly connected

Description

Tests whether the website is properly connected.

Usage

conn_test(url)

Arguments

url

A website url address.

Value

A string that returns "ok" if the connection is normal and "no" otherwise.

Examples

# Example(Not run)
# conn_test("www.baidu.com")

Download file from GitHub via the proxy site

Description

This function can be used to download a file from GitHub via the proxy website <https://mirror.ghproxy.com/> or <https://gh-proxy.com/>.

Usage

download_file(
  url,
  destfile,
  method,
  quiet = FALSE,
  mode = "w",
  cacheOK = TRUE,
  extra = getOption("download.file.extra"),
  headers = NULL
)

Arguments

url

a character string (or longer vector for the "libcurl" method) naming the URL of a resource to be downloaded.

destfile

a character string (or vector, see the url argument) with the file path where the downloaded file is to be saved. Tilde-expansion is performed.

method

Method to be used for downloading files. Current download methods are "internal", "libcurl", "wget", "curl" and "wininet" (Windows only), and there is a value "auto": see ‘Details’ and ‘Note’. The method can also be set through the option "download.file.method": see options().

quiet

If TRUE, suppress status messages (if any), and the progress bar.

mode

character. The mode with which to write the file. Useful values are "w", "wb" (binary), "a" (append) and "ab". Not used for methods "wget" and "curl". See also ‘Details’, notably about using "wb" for Windows.

cacheOK

logical. Is a server-side cached value acceptable?

extra

character vector of additional command-line arguments for the "wget" and "curl" methods.

headers

named character vector of additional HTTP headers to use in HTTP[S] requests. It is ignored for non-HTTP[S] URLs. The User-Agent header taken from the HTTPUserAgent option (see options) is automatically used as the first header.

Examples

# Example(Not run)
# download_file(
#  url = "https://github.com/hadley/mastering-shiny/raw/main/neiss/products.tsv",
#  destfile = "products.tsv",
#  quiet = TRUE
# )

Install R packages from GitHub via the proxy site

Description

When you want to install R packages from GitHub, but you can't access GitHub, this function helps you download and install R packages from GitHub via the proxy website <https://mirror.ghproxy.com/> or <https://gh-proxy.com/>, which is in real-time sync with GitHub.

Usage

install_github(
  repo,
  subdir = NULL,
  ref = NULL,
  upgrade = c("default", "ask", "always", "never"),
  force = FALSE,
  quiet = FALSE,
  build = TRUE
)

Arguments

repo

Repository address in the format username/repo.

subdir

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

ref

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

upgrade

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

force

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

quiet

If TRUE, suppress output.

build

If TRUE build the package before installing.

Examples

# Example(Not run)
# install_github("yihui/xfun")