getpd | R Documentation |
Find the project root directory by traversing the current working directory filepath upwards until a given set of files is found.
getpd(root.files = c(".git", "DESCRIPTION", "NAMESPACE"))
root.files |
if any of these files is found in a parent folder, the path to that folder is returned |
getpd
returns the absolute, normalized project root directory as string. The forward slash is used as path separator (independent of the OS).
local({
base_pkg_root_dir <- system.file(package = "base")
base_pkg_R_dir <- file.path(base_pkg_root_dir, "R")
owd <- setwd(base_pkg_R_dir); on.exit(setwd(owd))
getpd()
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.