Importación de datos
setwd("~/Estadistica")
library(readxl)
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.0 v dplyr 1.0.5
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(prettydoc)
library(readr)
library(DT)
library(pacman)
p_load("base64enc","htmltools","mime","xfun","prettydoc","readr","knitr","DT","dplyr","ggplot2","plotly","gganimate","gifski","scales")
temperatura <- read.csv("Temperatura.csv")
PIB <- read.csv("PIBmex.csv")
CO2 <- read_excel("CO2PIB.xlsx")
Variación de CO2 vs PIB (1960-2016)
datos <- data.frame(CO2)
datos1 <- datos %>%
ggplot(aes(x = Año, y = CO2, size = PIB)) +
geom_point(alpha = 0.6)+
scale_size_continuous(range = c(1,7))+
labs(x = "Año" , y = "CO2 (toneladas per capital)", size = "PIB")+
ggtitle("Niveles de CO2 vs Producto Interno Bruto (PIB)") +
scale_y_continuous(labels = comma)
ggplotly(datos1)
Anomalía de la temperatura de (1960 a 2016)
datos1 <- data.frame(temperatura)
datos1["PIB"] <- PIB$percapita
datos2 <- datos1 %>%
ggplot(aes(x = año, y =anomalia, size = PIB)) +
geom_point(alpha = 0.6)+
scale_size_continuous(range = c(1,7))+
labs(x = "año" , y = "variacion de temperatura", size = "PIB") +
scale_y_continuous(labels = comma)
ggplotly(datos2)