paths_help | R Documentation |
Take an file reference and get its directories, path, and name; its parent's directories, path, and name. Convert a ...
args to a path, check the validity of a path, and create new directories within a given directory.
paths_help()
is_path(..., err = F)
as_path(..., err = T)
object_dirs(path, err = T)
parent_dirs(path, err = T)
object_path(path, err = T)
parent_path(path, err = T)
object_name(path, err = T)
parent_name(path, err = T)
new_dirs(dirs, path = NULL)
... |
Atomic arguments pasted to create a path. |
err |
|
path |
A complete character scalar path to either a directory or a file. |
dirs |
A complete character vec of new sub-directory names. |
In most cases, if (optionally) specified, functions throw an error if ...
does not resolve to a valid object path.
A character scalar
object_dirs, parent_path
object_name, parent_name
as_path
A character vector
object_dirs, parent_dirs
A logical scalar
is_path
is_path()
: Checks whether ...
resolves to a valid path for an object (file or folder) when ...
arguments are collapsed into a character scalar.
as_path()
: Collapses ...
into a path using the current platform file path separator .Platform$file.sep
.
object_dirs()
: Calls object_path
and split the resulting character scalar into a character vector containing the name of the root folder, the names of any intermediate folders, the name of the parent folder of the object, and the name of the object.
parent_dirs()
: Calls parent_path
and split the resulting character scalar into a character vector containing the name of the root folder, the names of any intermediate folders, and the name of the parent folder of the object specified by ...
.
object_path()
: Collapses ...
into a character scalar and expand the path to the object indicated by the result to account for relative paths.
parent_path()
: Calls object_path
and extract from the resulting character scalar just the path to the parent folder of the object specified by ...
(i.e., discarding the name of the object itself).
object_name()
: Calls object_path
and extract from the resulting character scalar just the name of the object, discarding the path to its parent.
parent_name()
: Calls parent_path
and extract from the resulting character scalar just the name of last folder in the path.
new_dirs()
: Creates sub-directories within an existing directory, optionally asking the user to choose that existing directory.
Other files:
rd_help()
,
read_rct_delim()
path. <- path.expand("~")
parts. <- ss(.Platform$file.sep, path.)
parts. <- parts.[parts. != ""]
parts.[1] <- paste0(.Platform$file.sep, parts.[1])
parts. <- paste0("'", parts., "'")
code. <- paste0(parts., collapse = ", ")
is_path. <- paste0("is_path(", code., ")")
as_path. <- paste0("as_path(", code., ")")
path.
parts.
is_path.
as_path.
parent_dirs(path.)
object_dirs(path.)
parent_path(path.)
object_path(path.)
parent_name(path.)
object_name(path.)
run(is_path.)
run(as_path.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.