Description Usage Arguments Value Examples
Stock prices are known for been non-stationary. Use get_returns()
as a
pre-processing step for econometric modeling.
1 2 3 4 5 6 7 | get_returns(.tbl, .group, .type, .omit_na = FALSE, ...)
## Default S3 method:
get_returns(.tbl, .group, .type, .omit_na = FALSE, ...)
## S3 method for class 'tbl_df'
get_returns(.tbl, .group, .type, .omit_na = FALSE, ...)
|
.tbl |
A tidy |
.group |
The column in which the data should be grouped. This will often be a column with stock tickers or stocks names. |
.type |
The method used to calculate returns. One of:
|
.omit_na |
Should NA values be omitted? Default is |
... |
The column (or columns) in which the calculation should be conducted. |
A tidy tibble
.
1 2 3 4 5 6 7 | library(YahooTickers)
library(dplyr)
get_tickers(dow) %>%
slice(1:3) %>%
get_stocks(.) %>%
get_returns(., .group = tickers, .type = arithmetic,
.omit_na = TRUE, adjusted)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.