I. Exploración de datos

1.1. Base datos

head(mtcars)
mtcars

1.2. Estadísticas descriptivas

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

1.3. Graficos

plot(mtcars$wt, mtcars$mpg, xlab="Weignt", ylab="MPG")

plot(mtcars$wt, mtcars$mpg, xlab="Weight", ylab="MPG")
Weight and MPG

Weight and MPG

Weight and MPG

Weight and MPG

II. Mapa interactivo con Leaflet

2.1 Cargar la librería leaflet

install.packages(“leaflet”)

2.2 Cargar la librería leaflet

library(leaflet)
## Warning: package 'leaflet' was built under R version 4.4.2
## 2.3. Crear un mapa básico centrado en una ubicación específica

### Crear mapa y asignarlo a una variable
mapa <- leaflet() %>%
  addTiles() %>%
  setView(lng = -3.7038, lat = 40.4168, zoom = 5) %>%
  addMarkers(lng = -3.7038, lat = 40.4168, popup = "Madrid, España")

### Llamar la variable para que se visualice
mapa