% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/path_select.R
\name{path_select_components}
\alias{path_select_components}
\title{Select path components by their position/index.}
\usage{
path_select_components(path, index, from = c("start", "end"))
}
\arguments{
\item{path}{A path of class \code{fs_path}.}

\item{index}{An integer vector of path positions. (A negative index will work
according to R's usual subsetting rules.)}

\item{from}{A character of either \code{"start"} or \code{"end"} to choose if indexing
should start from the first or last component of the \code{path}.}
}
\value{
An \code{fs_path} object, which is a character vector that also has class
\code{fs_path}.
}
\description{
\code{path_select_components()} allows to select individual components from
an \code{fs_path} object via their index.
}
\details{
\code{path_select_components()} is vectorized.
}
\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)
}
