\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{julenx} \pdfinfo{ /Title (datos-georeferenciados.pdf) /Creator (Cheatography) /Author (julenx) /Subject (Datos georeferenciados Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Datos georeferenciados Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{julenx} via \textcolor{DarkBackground}{\uline{cheatography.com/168626/cs/35775/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}julenx \\ \uline{cheatography.com/julenx} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 29th November, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Basic functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Archvios en el directorio} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}dir()} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Archivos en carpeta} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}dir("folder")} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{require(dgdal)} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Cargar cartografía} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\seqsplit{map=readOGR("folder\_address"},"name", \{\{nl\}\} ~ stringsAsFactors = FALSE)} \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Check structure of map} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}View(map) \{\{nl\}\} View(map@data)} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Map summary} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}summary(map)} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Plot map} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}plot(map)} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Add borders to map} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}require(tmap) \{\{nl\}\} tm\_shape(CCAA\_MAP)+ tm\_borders()} \tn % Row Count 17 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Dynamic representation}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{require(rgdal)} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{require(leaflet)} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{map=readOGR("folder","map\_name")} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{leaflet(map, \{\{nl\}\} ~ options = \seqsplit{leafletOptions(attributionControl} = FALSE))\{\{nl\}\} ~ \%\textgreater{}\% \seqsplit{addPolygons(data=CCAA\_MAP}, stroke=TRUE,\{\{nl\}\} ~ opacity = 0.5, fillOpacity = 0.7,color="grey10", \{\{nl\}\} ~ fillColor = \textasciitilde{}colorQuantile("YlOrBr", n=9, SALARIO,\{\{nl\}\} ~ na.color = "white")(SALARIO))} \tn % Row Count 10 (+ 7) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{leaflet(CCAA\_MAP,options = \seqsplit{leafletOptions(attributionControl} = FALSE)) \%\textgreater{}\% addTiles()\%\textgreater{}\% \seqsplit{addPolygons(data=CCAA\_MAP}, stroke=TRUE, color="grey10")} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Cargamos el OpenStreetMap (OSM)} \tn % Row Count 14 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{leaflet(CCAA\_MAP,options = \seqsplit{leafletOptions(attributionControl} = FALSE)) \%\textgreater{}\% addTiles()\%\textgreater{}\% \seqsplit{addPolygons(data=CCAA\_MAP}, stroke=TRUE, opacity = 0.25, fillOpacity = 0.27,color="grey10", fillColor = \textasciitilde{}colorQuantile("YlOrBr", n=9, SALARIO, na.color = "white")(SALARIO))} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Realizamos la representación dinámica + OSM} \tn % Row Count 21 (+ 7) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{library(tmap) \{\{nl\}\} tmap\_mode("view")} \tn % Row Count 22 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{tm\_shape(CCAA\_MAP) + tm\_fill(palette ="Blues",col = "SALARIO",style = "quantile")} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Otra opción sin OpenStreetMap} \tn % Row Count 25 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Localización de datos espaciales}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{datos\_map\textless{}-data.frame( \{\{nl\}\} ~ longx= c(-3.741274,-3.718765,-3.707027), \{\{nl\}\} ~ laty=c(40.38479, 40.36751, 40.45495))} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Para situar marcadores} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{marker\_icon \textless{}- makeIcon( iconUrl = \seqsplit{"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.8.0-beta.0/images/marker-icon.png"}, shadowUrl = \seqsplit{"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.8.0-beta.0/images/marker-shadow.png")}} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Obtenemos los marcadores del repositorio de la libería leaflet} \tn % Row Count 12 (+ 7) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{leaflet(data=datos\_map) \%\textgreater{}\% addTiles()\%\textgreater{}\% \seqsplit{addMarkers(data=datos\_map},lng=\textasciitilde{}longx, lat=\textasciitilde{}laty, icon = marker\_icon)} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\# Para integrarlo con la librería leaflet} \tn % Row Count 16 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Add info from csv to map}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Load csv} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\seqsplit{new\_data=read.csv("new\_data.csv"},sep = ";")} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Check info} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}View(new\_data)} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Add data to map} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}require(dplyr) \{\{nl\}\} \seqsplit{map@data=dplyr::left\_join(map@data},new\_data, \{\{nl\}\} ~ \seqsplit{by=c("map\_col"="new\_data\_col"))}} \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Check new data} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}View(CCAA\_MAP@data)} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Adding data changes row names, so we change them back} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\seqsplit{rownames(map@data)=map@data\$map\_col}} \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Cambiar el nombre de los polígonos para que sean igual que tengan el mismo nombre que las filas de los datos mapa} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}new\_IDs = rownames(map@data) \{\{nl\}\} for (i in 1:length(slot(map, "polygons")))\{ \{\{nl\}\} ~ slot(slot(map, "polygons"){[}{[}i{]}{]}, "ID") = new\_IDs{[}i{]} \{\{nl\}\} \}} \tn % Row Count 20 (+ 7) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Mapa con los nuevos datos} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}require(tmap) \{\{nl\}\} tm\_shape(map) + tm\_borders() \{\{nl\}\} tm\_shape(map) + tm\_polygons(col = "SALARIO")} \tn % Row Count 24 (+ 4) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Cambiar la paleta de colores} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}tm\_shape(CCAA\_MAP) + tm\_borders() + \{\{nl\}\} ~ tm\_fill(palette ="Blues",col = "SALARIO",\{\{nl\}\} ~ style = "quantile")} \tn % Row Count 28 (+ 4) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Más información} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}tm\_shape(CCAA\_MAP) + tm\_fill(palette ="Blues",col = "SALARIO",style = "quantile")+ tm\_bubbles(size = "SALARIO",scale=1,style = "quantile", col = "darkblue")} \tn % Row Count 33 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Add info from csv to map (cont)}} \tn % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Cambiar algunas opciones de leyenda} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}map1 = tm\_shape(CCAA\_MAP) + \{\{nl\}\} ~ tm\_fill(palette ="Blues",col = "SALARIO",style = "quantile")+ \{\{nl\}\} ~ tm\_bubbles(size = "SALARIO",scale=1,style = "quantile", col = "SALARIO")+ \{\{nl\}\} ~ \seqsplit{tm\_layout(legend.title.size} = .7, \{\{nl\}\} ~ legend.text.size =0.6, \{\{nl\}\} ~ legend.position = c("right","bottom"), \{\{nl\}\} ~ legend.bg.color = "white", \{\{nl\}\} ~ legend.bg.alpha = 1, \{\{nl\}\} ~ legend.stack = "horizontal", \{\{nl\}\} ~ legend.width = 1.5, \{\{nl\}\} ~ legend.height = 1.5) \{\{nl\}\} map1} \tn % Row Count 14 (+ 14) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{guardar la nueva cartografía} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}writeOGR(obj=map, dsn="folder", layer="CCAA\_SALARIOS", driver="ESRI Shapefile")} \tn % Row Count 17 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{guardar la imagen en formato jpeg} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}tmap\_save(map1, filename="map1.jpeg", width=15, height=10, units="cm")} \tn % Row Count 20 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Añadir fichero con localizaciones}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\seqsplit{load(file="datos\_CCAA/Data\_Housing\_Madrid}.RData") \# Ojo con el directorio View(Datos\_house)} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Cargamos datos desde fichero} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{par(mfrow=c(1,1)) \seqsplit{hist(Datos\_house\$house.price)}} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}acemos un histograma para ver la distribución del precio de la vivienda en Madrid} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{mapa\_pisos = leaflet(data=Datos\_house{[}sample(nrow(Datos\_house),100),{]}) \%\textgreater{}\% addTiles() \%\textgreater{}\% \# Add default OpenStreetMap map tiles addMarkers(lng=\textasciitilde{}longitude, lat=\textasciitilde{}latitude, icon = marker\_icon, popup=\textasciitilde{}paste0(type.house, " - ", house.price, " euros"))} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Localizamos dichos datos y lo integramos con la librería leaflet} \tn % Row Count 15 (+ 9) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{mapa\_pisos} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Representamos dinámicamente el objeto creado antes} \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{More tools}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Color map based on information already contained} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}tm\_shape(CCAA\_MAP) + \{\{nl\}\} ~ tm\_borders(col = "black")+ \{\{nl\}\} ~ tm\_shape(Munic\_ESP)+ \{\{nl\}\} ~ \seqsplit{tm\_fill(col="PrecioIn16"}, style = "quantile" )} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Cambiar sistema de referencia} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}require(rgdal) \{\{nl\}\} CRS.new = CRS("+init=epsg:4258") \{\{nl\}\} Munic\_ESP = spTransform(Munic\_ESP, CRS.new) \{\{nl\}\} View(Munic\_ESP@data) \{\{nl\}\}} \tn % Row Count 10 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Loading maps alternative}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{require(sf)} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{map=st\_read("map.shp")} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{View(CCAA\_MAP)} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Visualizamos su estructura} \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{summary(CCAA\_MAP)} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{class(CCAA\_MAP)} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Clase del objeto creado (data.frame)} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Lista de geometría} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}st\_geometry(CCAA\_MAP)} \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Una de las geometrías} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}st\_geometry(CCAA\_MAP){[}{[}13{]}{]}} \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{methods(class='sfc')} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Operaciones con geometría} \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{map2 = cbind(map, \seqsplit{st\_coordinates(st\_centroid(map)))}} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Obtain centroid of map} \tn % Row Count 16 (+ 3) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{plot(CCAA\_MAP{[}1{]})} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Map of each variable} \tn % Row Count 18 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{require(ggplot2) \{\{nl\}\} ggplot(data=CCAA\_MAP)+ \{\{nl\}\} \&nsbp; geom\_sf()+ \{\{nl\}\} \&nsbp; theme\_minimal()} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Another option to style maps} \tn % Row Count 22 (+ 4) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\seqsplit{salarios=read.csv("datos\_CCAA/SALARIOS.csv"},sep = ";")} \tn % Row Count 24 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{require(dplyr)} \tn % Row Count 25 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{CCAA\_MAP\textless{}-dplyr::left\_join(CCAA\_MAP,salarios, \seqsplit{by=c("cod\_CCAA"="COD\_CCAA"))}} \tn % Row Count 27 (+ 2) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{View(CCAA\_MAP)} \tn % Row Count 28 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{require(tmap)} \tn % Row Count 29 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{require(RColorBrewer)} \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Loading maps alternative (cont)}} \tn % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{tm\_shape(CCAA\_MAP) + tm\_borders()} \tn % Row Count 1 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{tm\_shape(CCAA\_MAP) + tm\_polygons(col = "SALARIO")} \tn % Row Count 3 (+ 2) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{tm\_shape(CCAA\_MAP) + tm\_fill(palette ="Blues",col = "SALARIO",style = "quantile")} \tn % Row Count 5 (+ 2) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{tm\_shape(CCAA\_MAP) + tm\_fill(palette ="Blues",col = "SALARIO",style = "quantile")+ tm\_bubbles(size = "SALARIO",scale=1,style = "quantile", col = "SALARIO")} \tn % Row Count 9 (+ 4) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{st\_write(obj=CCAA\_MAP,dsn = \seqsplit{"cartografías/CCAA\_SALARIOS}.shp", append=FALSE)} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Plotting new info changes a bit} \tn % Row Count 12 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}