Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run tq_get when running in rmarkdown. Will run as normal R script file #208

Open
donojazz opened this issue Oct 18, 2021 · 0 comments

Comments

@donojazz
Copy link

This will not run in .rmd

sp_500 <- tq_index("SP500") %>%
  tq_get(get = "stock.prices")

sp_500 %>%
  group_by(symbol) %>%
  tq_transmute(adjusted,mutate_fun = monthlyReturn)

Error returns: Getting holdings for SP500
Warning: Problem with mutate() column data...
i data.. = purrr::map(...).
i type_convert() only converts columns of type 'character'.

  • df has no columns of type 'character'

Same code in r file runs fine (I wanted to use markdown)...

sp_500 <- tq_index("SP500") %>%
tq_get(get = "stock.prices")

sp_500 %>%
group_by(symbol) %>%
tq_transmute(adjusted,mutate_fun = monthlyReturn)

Return:
AAPL
Apple Inc.
03783310
2046251
0.05996623
Information Technology
166073040
USD
2011-01-03
11.63000
11.79500
11.60143
11.77036
445138400
10.106221
2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant