Learn R Programming

xfun (version 0.61)

is_abs_path: Test if paths are relative or absolute

Description

On Unix, check if the paths start with / or ~ (if they do, they are absolute paths). On Windows, check if the paths start with a drive letter (e.g., C:), a (back)slash (e.g., /foo), a UNC prefix (e.g., \\host\share), or ~.

Usage

is_abs_path(x)

is_rel_path(x)

Value

A logical vector.

Arguments

x

A vector of paths.

Examples

Run this code
xfun::is_abs_path(c("C:/foo", "foo.txt", "/Users/john/", tempdir()))
xfun::is_rel_path(c("C:/foo", "foo.txt", "/Users/john/", tempdir()))

Run the code above in your browser using DataLab