is.absolutePath | R Documentation |
Checks a vector of paths to see if they are absolute paths. Returns a
corresponding logical vector that is TRUE
for absolute paths and
FALSE
for others. Implementation uses a regular expression so this
may not always work correctly, especially in non-ascii settings. No
checks are made to see if a path exists nor if it is even a valid path.
is.absolutePath(paths)
paths |
A character vector to check to see if which are potentially absolute paths. |
A logical vector that is TRUE
for absolute paths=
,
FALSE+
for most other things (including NA
and empty string),
and an empty vector if paths=
is empty or NULL
.
# All absolute paths
is.absolutePath( c( "~", "/", "\\", "~/bob", "/bob", "\\bob" ))
is.absolutePath( c("C:\\", "c:/", "C:\\bob", "c:/bob" ))
is.absolutePath( c(".", "./", ".\\", "./bob", ".\\bob" ))
is.absolutePath( c(".", "./", ".\\", "./bob", ".\\bob" ))
is.absolutePath( c("..", "../", "..\\", "../bob", "..\\bob" ))
is.absolutePath( c("/[](){}''|;:::Invalid but absolute!" ))
# None are absolute paths
is.absolutePath( c("", "bob/../bob", "bob\\..\\bob" ))
is.absolutePath( c("bob", "bob\\bob", "bob/bob", ".bob" ))
is.absolutePath( c( NA, "NA", "BETA_ß_" ))
is.absolutePath( list( x= "hello" ))
# empty logical returned
is.absolutePath( NULL )
is.absolutePath( character( 0 ))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.