Tarea con Mosaic y un mapa

Daniel Felipe Malagon Vega

library(mosaic)
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following object is masked from 'package:ggplot2':
## 
##     stat
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
capitales.departamentos.colombia <- c("Bogotá", "Medellín", "Cali", "Popayán", "Quibdo", "Pasto", "Ibagué", "Santa Marta", "Cartagena", "Barranquilla", "Bucaramanga", "Cúcuta", "Manizales", "Pereira", "Neiva", "Villavicencio", "Armenia", "Valledupar", "Montería", "Sincelejo", "Riohacha", "Florencia", "Tunja", "Arauca", "Yopal", "Leticia", "San Jose del Guaviare", "Inírida", "Mocoa", "San Andres", "Mitú", "Puerto Carreño")
coordenadas <- data.frame(
  long = c(-74.07610, -75.56866, -76.53248, -76.60624, -76.6615, -77.2816, -75.2433, -74.2123, -75.5504, -74.7797, -73.1198, -72.50782, -75.51738, -75.69611, -75.28189, -73.62664, -75.68111, -73.25322, -75.88143, -75.39778, -72.90722, -75.60623, -73.36778, -70.75908, -72.39568, -69.94056, -72.64591, -67.92366, -76.64716, -81.71974, -70.23319, -67.48256), 
  lat= c(4.59808, 6.25242, 3.45120, 2.44178, 5.68911, 1.21700, 4.44506, 11.24533, 10.42173, 10.98162, 7.12539, 7.89391, 5.06889, 4.841333, 2.9273, 4.142, 4.53389, 10.46314, 8.74798, 9.30472, 11.54444, 1.61438, 5.53528, 7.0847, 5.33775, -4.21528, 2.57286, 3.86809, 1.14667, 12.54671, 1.25672, 6.185660), 
                          stringsAsFactors = F) 
coordenadas$capitales.departamentos.colombia <- capitales.departamentos.colombia      
mapa.mundo <- map_data("world")
mapa.mundo %>%  ggplot() + 
  geom_polygon(aes( x=long, y = lat, group = group), fill = "green4", color = "Grey80") +
  theme_minimal() +
  theme(axis.line = element_blank(), axis.text = element_blank(), axis.title = element_blank(), axis.ticks = element_blank(), panel.background =    element_rect(colour= "black", size= 0.02)) +
  ggtitle( "Colombia") +
  coord_fixed (xlim= c(-83,-66), ylim= c(-4,12), ratio = 0.7)+
  geom_point(data=coordenadas, aes(long, lat), color= "red2", size=2) + 
  geom_text (data = coordenadas, aes(long, lat, label =capitales.departamentos.colombia))