expand_path: Expand a path with a parent directory

View source: R/expand_path.R

expand_pathR Documentation

Expand a path with a parent directory

Description

Accessory function which checks if a path is absolute or relative; if relative, use a specified parent directory instead than the working directory to expand it. Useful for functions which accept more than one path as arguments, in which one of them contains the absolute position, and the others do not.

Usage

expand_path(path, parent = getwd(), silent = TRUE, normalize = TRUE)

Arguments

path

The path name (character) to check ad eventually expand.

parent

The parent directory (character) to use if path is relative (default value: the working directory).

silent

Logical value: if TRUE (default), no message are shown; if FALSE, a message inform if parent were applied or not; if NA, a warning is returned if path is expanded, nothing if it is already an absolute path.

normalize

Logical value: if TRUE (default), the path is normalised (normalizePath() is applied); if FALSE it is simply appended.

Value

The path eventually expanded.

Note

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2019)

References

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.


sen2r documentation built on Nov. 10, 2023, 9:08 a.m.