1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api.R
\name{slice}
\alias{slice}
\title{Which time steps fall within two extreme values}
\usage{
slice(x, extremes, rightmost.closed = FALSE)
}
\arguments{
\item{x}{The \code{CFTime} instance to operate on.}
\item{extremes}{Character vector of two timestamps that represent the
extremes of the time period of interest. The timestamps must be in
increasing order. The timestamps need not fall in the range of the time
steps in argument `x.}
\item{rightmost.closed}{Is the larger extreme value included in the result?
Default is \code{FALSE}.}
}
\value{
A logical vector with a length equal to the number of time steps in
\code{x} with values \code{TRUE} for those time steps that fall between the two
extreme values, \code{FALSE} otherwise. The earlier timestamp is included, the
later timestamp is excluded. A specification of \code{c("2022-01-01", "2023-01-01")}
will thus include all time steps that fall in the year 2022.
}
\description{
Given two extreme character timestamps, return a logical vector of a length
equal to the number of time steps in the \link{CFTime} instance with values \code{TRUE}
for those time steps that fall between the two extreme values, \code{FALSE}
otherwise. This can be used to select slices from the time series in reading
or analysing data.
}
\details{
If bounds were set these will be preserved.
}
\examples{
t <- CFtime("hours since 2023-01-01 00:00:00", "standard", 0:23)
slice(t, c("2022-12-01", "2023-01-01 03:00"))
}
|