Description Usage Arguments Details Value Examples
Subset an xts time series (extract an xts subseries corresponding to the input dates).
1 

An xts time series. 

The start date of the extracted time series data. 

The end date of the extracted time series data, or the number of data rows to be extracted. 

A Boolean argument: if 
The function sub_set()
extracts an xts subseries
corresponding to the input dates. If end_date
is a date object or
a character string representing a date, then sub_set()
performs
standard bracket subsetting using the package
xts.
The rows of data don't necessarily correspond to consecutive calendar days
because of weekends and holidays. For example, 10 consecutive rows of data
may correspond to 12 calendar days. So if end_date
is a number, then
we must choose to extract either the given number of rows of data
(get_rows=TRUE
) or the given number of calendar days
(get_rows=FALSE
).
If end_date
is a positive number then sub_set()
returns the
specified number of data rows from the future, and if it's negative then it
returns the data rows from the past.
If end_date
is a number, and either start_date
or
end_date
are outside the date range of x_ts
, then
sub_set()
extracts the maximum available range of x_ts
.
An xts time series with the same number of columns as the input time series.
1 2 3 4 5 6 7 8  # Subset an xts time series using two dates
rutils::sub_set(rutils::etf_env$VTI, start_date="20150101", end_date="20150110")
# Extract 6 consecutive rows of data from the past, using a date and a negative number
rutils::sub_set(rutils::etf_env$VTI, start_date="20150101", end_date=6)
# Extract 6 calendar days of data
rutils::sub_set(rutils::etf_env$VTI, start_date="20150101", end_date=6, get_rows=FALSE)
# Extract up to 100 consecutive rows of data
rutils::sub_set(rutils::etf_env$VTI, start_date="20160801", end_date=100)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.