Learn R Programming

this.path (version 2.5.0)

path.split: Split File Path Into Individual Components

Description

Split the path to a file into components in a platform-DEPENDENT way.

Usage

path.split(path)
path.split.1(path)
path.unsplit(...)

Value

for path.split(), a list of character vectors.

for path.split.1() and path.unsplit(), a character vector.

Arguments

path

character vector.

...

character vectors, or one list of character vectors.

Examples

Run this code
path <- c(
    NA,
    "",
    paste0("https://raw.githubusercontent.com/ArcadeAntics/PACKAGES/",
           "src/contrib/Archive/this.path/this.path_1.0.0.tar.gz"),
    "\\\\host\\share\\path\\to\\file",
    "\\\\host\\share\\",
    "\\\\host\\share",
    "C:\\path\\to\\file",
    "C:path\\to\\file",
    "path\\to\\file",
    "\\path\\to\\file",
    "~\\path\\to\\file",
    ## paths with character encodings
    `Encoding<-`("path/to/fil\xe9", "latin1"),
    "C:/Users/iris/Documents/\u03b4.R"
)
print(x <- path.split(path))
print(path.unsplit(x))

Run the code above in your browser using DataLab