getPath {Smisc} | R Documentation |
Get the path of a vector of filenames
getPath(vec)
vec |
Character vector (usually containing filenames) |
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.
Character vector with pathnames only, the filename removed
Landon Sego
Additional functions for filename manipulations: stripExtension
, getExtension
,
stripPath
, grabLast
, basename
, dirname
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)