localOrRemoteFile: Dynamically handle a local or remote file path

Description Usage Arguments Value Vectorization Compressed files Note See Also Examples

View source: R/localOrRemoteFile.R

Description

Dynamically handle a local or remote file path

Usage

1
2
3
4
5
localOrRemoteFile(
  file,
  tempPrefix = "pipette",
  quiet = getOption("acid.quiet", default = FALSE)
)

Arguments

file

character(1). Local file paths or remote URLs.

tempPrefix

character(1). Prefix to use for temporary file basename.

quiet

logical(1). Perform command quietly, suppressing messages.

Value

character. Local file path(s). Stops on a missing file.

Vectorization

This function is vectorized and supports mixed local and remote paths. Remote files are downloaded locally to a temporary directory.

Compressed files

Compressed files will automatically be decompressed. Currently, these file extensions are natively supported: BZ2, GZ, XZ, and ZIP.

Note

Updated 2021-06-10.

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Local
file <- system.file("extdata/example.csv", package = "pipette")
x <- localOrRemoteFile(file)
basename(x)

## Remote
file <- AcidBase::pasteURL(
    pipetteTestsURL,
    "hgnc.txt.gz",
    protocol = "none"
)
x <- localOrRemoteFile(file)
basename(x)

acidgenomics/pipette documentation built on Sept. 27, 2021, 9:10 a.m.