Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 a path remains the same (via xfun::same_path()) if it is prepended with ‘./’ (if it does, it is a relative path).

Usage

is_abs_path(x)

is_rel_path(x)

Arguments

x

A vector of paths.

Value

A logical vector.

Examples

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

xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.