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.
Examples
dir <- getwd()
url <- pasteUrl(
"r.acidgenomics.com",
"acidbase",
"reference",
"parentDirectory.html",
protocol = "https"
)
path <- c(dir, url)
parentDir(path = path)
#> [1] "/Users/stmich14/git/personal/r-acidbase/docs"
#> [2] "https://r.acidgenomics.com/acidbase/reference"