Skip to content

Instantly share code, notes, and snippets.

@sergiospagnuolo
Created January 12, 2021 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiospagnuolo/70eb0859d24dd870bfb267c009f77e16 to your computer and use it in GitHub Desktop.
Save sergiospagnuolo/70eb0859d24dd870bfb267c009f77e16 to your computer and use it in GitHub Desktop.
Emplacamentos de veículos no Brasil
library(tidyverse)
emplacamentos <- read_delim("https://docs.google.com/spreadsheets/d/e/2PACX-1vRY5Wc7j9qAEbStZioZBGEQB_o4S_eyJnVca8oP7gGTafvg8ZwDdZWYkzAx_455KOs3Q9uZQ9qSFIZ3/pub?gid=0&single=true&output=csv", delim = ",", locale = locale(grouping_mark = "."))
emplacamentos$Ano <- as.Date(paste0(emplacamentos$Ano, "-01-01"))
marcas <- read_delim("https://docs.google.com/spreadsheets/d/e/2PACX-1vRY5Wc7j9qAEbStZioZBGEQB_o4S_eyJnVca8oP7gGTafvg8ZwDdZWYkzAx_455KOs3Q9uZQ9qSFIZ3/pub?gid=794101571&single=true&output=csv", delim = ",", locale = locale(grouping_mark = "."))
marcas$Ano <- as.Date(paste0(marcas$Ano, "-01-01"))
emplacamentos %>% ggplot(aes(Ano,Total)) +
geom_line() +
geom_smooth(method = "lm", se = F ) +
scale_y_continuous(labels=function(x) format(x, big.mark = ",", scientific = FALSE)) +
labs(title = "TOTAL DE EMPLACAMENTOS DE VEÍCULOS LEVES NO BRASIL POR ANO",
subtitle = "Emplacamentos indicam vendas de veículos",
caption = "Autoo/Fenabrave" )
marcas %>% filter(Veículo == "Ford") %>%
ggplot(aes(Ano,Total)) +
geom_line() +
geom_smooth(method = "lm", se = F ) +
scale_y_continuous(labels=function(x) format(x, big.mark = ",", scientific = FALSE)) +
labs(title = "TOTAL DE EMPLACAMENTOS DA FORD NO BRASIL POR ANO",
subtitle = "Emplacamentos indicam vendas de veículos",
caption = "FONTE: Autoo/Fenabrave" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment