pasteUrl: Concatenate strings to form a URL

View source: R/pasteUrl.R

pasteUrlR Documentation

Concatenate strings to form a URL

Description

Concatenate strings to form a URL

Usage

pasteUrl(..., protocol = c("none", "https", "http", "ftp", "rsync", "s3"))

Arguments

...

Character strings. Intentionally does not support recycling here, unlike base paste. Input of character vector as first argument alone is supported. Errors if NA values are present.

protocol

character(1). Desired protocol to use. Defaults to "https" but "http", "ftp", and "s3" (AWS S3) are also supported. Use "none" if you want to prepare a URL that already contains a protocol in the first element of the dots.

Details

Encoding is applied automatically via utils::URLencode.

Value

character(1). URL path.

Note

Updated 2023-09-19.

Examples

## HTTPS.
x <- pasteUrl(
    "r.acidgenomics.com",
    "packages",
    "acidbase",
    protocol = "https"
)
print(x)

## FTP.
x <- pasteUrl(
    "ftp.ensembl.org",
    "pub",
    "release-94",
    "gtf",
    "homo_sapiens",
    "Homo_sapiens.GRCh38.94.gtf.gz",
    protocol = "ftp"
)
print(x)

## Automatic encoding support.
x <- pasteUrl(
    "rest.ensembl.org",
    "info",
    "assembly",
    "Homo sapiens",
    protocol = "https"
)
print(x)

## Character vector support.
vec <- c("r.acidgenomics.com", "packages", "acidbase")
x <- pasteUrl(vec, protocol = "https")
print(x)

acidgenomics/r-acidbase documentation built on Jan. 12, 2024, 3:56 a.m.