joshuaulrich / joshuaulrich/quantmod
In getDividends have option to not append .div to the column name
- Dominant language
- R
- Stars
- 906
- Forks
- 233
- PR merge metrics
- No merged PRs in 30d
Description
Currently `getDividends` is hard coded to append `.div` to the column name. Would like to be able to specify name. Maybe name = "%s.div" if you wanted it and that could be the default or "%s" if not or "div" if you wanted name to be literally div.
In that case this could be simplified:
```r
library(dplyr);
library(quantmod);
library(purrr);
library(tools);
stocks <- c("AAPL", "MMM", "CAT", "MSFT", "TSLA");
map_dfr(stocks, \(x) getDividends(x) |>
fortify.zoo(melt = TRUE, names = c("date", "name", "div")) |>
tail(2) |>
mutate(name = file_path_sans_ext(name)))
```
to
```r
library(quantmod);
library(purrr);
stocks <- c("AAPL", "MMM", "CAT", "MSFT", "TSLA");
map_dfr(stocks, \(x) getDividends(x, name = "%s") |>
fortify.zoo(melt = TRUE, names = c("date", "name", "div")) |>
tail(2) )
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.