| path_select_components {fs} | R Documentation |
Select path components by their position/index.
Description
path_select_components() allows to select individual components from
an fs_path object via their index.
Usage
path_select_components(path, index, from = c("start", "end"))
Arguments
path |
A path of class |
index |
An integer vector of path positions. (A negative index will work according to R's usual subsetting rules.) |
from |
A character of either |
Details
path_select_components() is vectorized.
Value
An fs_path object, which is a character vector that also has class
fs_path.
Examples
path <- fs::path("some", "simple", "path", "to", "a", "file.txt")
path_select_components(path, 1:3)
path_select_components(path, 1:3, "end")
path_select_components(path, -1, "end")
path_select_components(path, 6)
[Package fs version 2.1.0 Index]