tidyquant (version 0.5.3)

as_xts: DEPRECATED: Coerce objects to xts, designed to work with tibble and data.frame objects

Description

Coerce objects to xts, designed to work with tibble and data.frame objects

DEPRECATED: Use timetk::tk_xts() instead.

Usage

as_xts(x, date_col = NULL, ...)

as_xts_(x, date_col = NULL, ...)

Arguments

x

A data.frame (with date column), matrix, xts, zoo, timeSeries, etc object.

date_col

Required for objects that inherit the data.frame class. Must specify a date column that is of the date class. Unused for non-data.frame objects.

...

Additional parameters passed to timetk::tk_xts().

Value

Returns a xts object.

Details

as_xts is a wrapper for xts::as.xts that includes a date_col argument. When date_col is specified, the date column is used as row names during coercion to xts class. The date column must be in a date format (i.e. date class).

as_xts_ evaluates the date_col using Non-Standard Evaluation (NSE). See vignette("nse") for details.

It is possible to coerce non-data.frame-like objects including zoo, timeSeries, ts, and irts objects. There is no need to specify the date_col argument.

See Also

Examples

Run this code
# NOT RUN {
# Load libraries
library(tidyquant)

tq_get("AAPL", get = "stock.prices") %>%
    as_xts(date_col = date) # Deprecated: Use tk_xts()


# }

Run the code above in your browser using DataCamp Workspace