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.

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/r-acidbase/docs"   
#> [2] "https://r.acidgenomics.com/packages/acidbase/reference"