Skip to contents

Parent directory recursion

Usage

parentDirectory(path, n = 1L)

parentDir(path, n = 1L)

Arguments

path

character. Local file and/or directory paths. Also supports URLs.

n

logical(1). Number of levels to recursive. Defaults to the immediate parent, similar to dirname.

Value

character. Directory path(s).

Details

Function always resolves directory path internally, using realpath.

Note

Updated 2021-09-03.

Examples

dir <- getwd()
url <- pasteUrl(
    "r.acidgenomics.com",
    "packages",
    "acidbase",
    "reference",
    "parentDirectory.html",
    protocol = "https"
)
path <- c(dir, url)
parentDir(path = path)
#> [1] "/Users/mike/git/monorepo/r-packages/AcidBase/docs"     
#> [2] "https://r.acidgenomics.com/packages/acidbase/reference"