convertPaths | R Documentation |
convertPaths
is simply a wrapper around gsub
for changing the
first part of a path.
convertRasterPaths
is useful for changing the path to a file-backed
raster (e.g., after copying the file to a new location).
convertPaths(x, patterns, replacements)
convertRasterPaths(x, patterns, replacements)
x |
For |
patterns |
Character vector containing a pattern to match (see |
replacements |
Character vector of the same length of |
A normalized path with the patterns
replaced by replacements
. Or a list of such
objects if x
was a list.
Eliot McIntire and Alex Chubaty
filenames <- c("/home/user1/Documents/file.txt", "/Users/user1/Documents/file.txt")
oldPaths <- dirname(filenames)
newPaths <- c("/home/user2/Desktop", "/Users/user2/Desktop")
convertPaths(filenames, oldPaths, newPaths)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.