library(BatchGetSymbols) tickers <- c('PETR4.SA', 'VALE3.SA', 'GGBR4.SA') df_stocks <- BatchGetSymbols(tickers = tickers, first.date = Sys.Date() - 500, last.date = Sys.Date())[[2]] p <- ggplot(df_stocks, aes(x = ref.date, y = price.adjusted, color = ticker)) + geom_line() + labs(title = paste0('Preços para ', paste0(tickers, collapse = ', ')) , subtitle = paste0('Dados de ', min(df_FB$ref.date), ' até ', max(df_FB$ref.date)), caption = "Solução para exercício 01, cap 10 - adfeR") print(p)
# none my_answers <- rep(0, 5)
Baixe dados das ações PETR3 (PETR3.SA), VALE3 (VALE3.SA), GGBR4 (GGBR4.SA) com BatchGetSymbols
para os últimos 1500 dias. Apresente, no mesmo gráfico, os preços das ações com diferentes cores de linhas. Mantenha todos demais aspectos do gráfico anterior.
extype: string
exsolution: r mchoice2string(c(TRUE, FALSE, FALSE, FALSE, FALSE), single = TRUE)
exname: "function 01"
exshuffle: TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.