getPath: Get the path of a vector of filenames

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Get the path of a vector of filenames

Usage

1
getPath(vec)

Arguments

vec

Character vector (usually containing filenames)

Details

Assumes paths are delineated using forward slashes. If an NA is supplied, then an NA is returned. If the desired string doesn't exist (see examples below), a "" is returned.

Value

Character vector with pathnames only, the filename removed

Author(s)

Landon Sego

See Also

Additional functions for filename manipulations: stripExtension, getExtension, stripPath, grabLast, basename, dirname

Examples

1
2
3
4
5
6
7
getPath(c(a="this.good.path/filename.R", b="nopath.R", c="/", d=NA,
          e="path1/path2/", ""))

# An example with 'real' files
files <- dir(file.path(path.package(package = "Smisc"), "data"), full.names = TRUE)
print(files)
getPath(files)


Search within the Smisc package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.