From 8d5d461b9d6aa2f195c0a025760c68ee9ad12a54 Mon Sep 17 00:00:00 2001 From: "Daniel E. de la Rosa" Date: Fri, 1 Dec 2023 18:01:26 -0400 Subject: [PATCH] fix: remesas_provincias pkgdown unlisted --- .Rhistory | 234 +++++++++++++++++++++++++-------------------------- DESCRIPTION | 2 +- _pkgdown.yml | 1 + 3 files changed, 119 insertions(+), 118 deletions(-) diff --git a/.Rhistory b/.Rhistory index 2926da6..7c51e77 100644 --- a/.Rhistory +++ b/.Rhistory @@ -1,120 +1,3 @@ -"BAH", "Baoruco", "03", -"BAH", "Bahoruco", "03", -"BAR", "Barahona", "04", -"DAJ", "Dajabón", "05", -"DUA", "Duarte", "06", -"EP", "Elías Piña", "07", -"ES", "El Seibo", "08", -"ES", "El Seybo", "08", -"ESP", "Espaillat", "09", -"IND", "Independencia", "10", -"LA", "La Altagracia", "11", -"LR", "La Romana", "12", -"LV", "La Vega", "13", -"MTS", "María Trinidad Sánchez", "14", -"MC", "Monte Cristi", "15", -"PED", "Pedernales", "16", -"PER", "Peravia", "17", -"PP", "Puerto Plata", "18", -"HMI", "Hermanas Mirabal", "19", -"SAL", "Salcedo", "19", -"SAM", "Samaná", "20", -"SC", "San Cristóbal", "21", -"SJ", "San Juan", "22", -"SJ", "San Juan de la Maguana", "22", -"SPM", "San Pedro de Macorís", "23", -"SRA", "Sánchez Ramírez", "24", -"SAN", "Santiago", "25", -"SAN", "Santiago de los Caballeros", "25", -"SRO", "Santiago Rodríguez", "26", -"VAL", "Valverde", "27", -"MN", "Monseñor Nouel", "28", -"MP", "Monte Plata", "29", -"HMA", "Hato Mayor", "30", -"SJO", "San José de Ocoa", "31", -"SD", "Santo Domingo", "32" -) %>% -dplyr::relocate(PROV_ID, PROV_CODE, PROV_NAME) -DR_PROV <- sf::st_read("data-raw/shapes/RD_PROV_20211130/RD_PROV_20211130.shp", quiet = TRUE) -DR_PROV <- dplyr::select(DR_PROV, PROV_ID = PROV) -usethis::use_data(DR_PROV, overwrite = TRUE) -dr_munipality <- dplyr::tribble( -~MUN_ID, ~MUN_NAME, -"0000", "_NA_", -"0101", "Santo Domingo de Guzmán", -"0101", "Distrito Nacional", -"0201", "Azua", -"0201", "Azua de Compostela", -"0202", "Las Charcas", -"0203", "Las Yayas de Viajama", -"0203", "Las Yayas", -"0204", "Padre Las Casas", -"0205", "Peralta", -"0206", "Sabana Yegua", -"0207", "Pueblo Viejo", -"0208", "Tábara Arriba", -"0209", "Guayabal", -"0210", "Estebanía", -"0301", "Neiba", -"0302", "Galván", -"0303", "Tamayo", -"0304", "Villa Jaragua", -"0305", "Los Ríos", -"0401", "Barahona", -"0402", "Cabral", -"0403", "Enriquillo", -"0404", "Paraíso", -"0405", "Vicente Noble", -"0406", "El Peñón", -"0407", "La Ciénaga", -"0408", "Fundación", -"0409", "Las Salinas", -"0409", "Salinas", -"0410", "Polo", -"0411", "Jaquimeyes", -"0501", "Dajabón", -"0502", "Loma de Cabrera", -"0503", "Partido", -"0504", "Restauración", -"0505", "El Pino", -"0601", "San Francisco de Macorís", -"0601", "Duarte", -"0602", "Arenoso", -"0603", "Castillo", -"0604", "Pimentel", -"0605", "Villa Riva", -"0606", "Las Guáranas", -"0607", "Eugenio María de Hostos", -"0607", "Hostos", -"0701", "Comendador", -"0702", "Bánica", -"0703", "El Llano", -"0704", "Hondo Valle", -"0705", "Pedro Santana", -"0706", "Juan Santiago", -"0801", "El Seibo", -"0802", "Miches", -"0901", "Moca", -"0902", "Cayetano Germosén", -"0903", "Gaspar Hernández", -"0904", "Jamao al Norte", -"0905", "San Víctor", -"1001", "Jimaní", -"1002", "Duvergé", -"1003", "La Descubierta", -"1004", "Postrer Río", -"1005", "Cristóbal", -"1006", "Mella", -"1101", "Higüey", -"1102", "San Rafael del Yuma", -"1201", "La Romana", -"1202", "Guaymate", -"1203", "Villa Hermosa", -"1301", "La Vega", -"1301", "La Concepción de La Vega", -"1302", "Constanza", -"1303", "Jarabacoa", -"1304", "Jima Abajo", "1401", "Nagua", "1402", "Cabrera", "1403", "El Factor", @@ -510,3 +393,120 @@ pkgdown::build_site() pkgdown::build_site() pkgdown::build_site() usethis::use_pkgdown_github_pages() +install.packages('sfDR', repos = c('https://adatar-do.r-universe.dev', 'https://cloud.r-project.org')) +readxl::read_excel('Remesas_PR.xlsx') +readxl::read_excel('data-raw/Remesas_PR.xlsx') +readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) +readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +dplyr::select(1:2) +library(dplyr) +readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +select(1:2) +library(tidyr) +readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +select(1:2) +readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +select(1:2) %>% +drop_na() +readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +select(1:2) %>% +drop_na() %>% +setNames(c('provincia', 'porcentaje')) +readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +select(1:2) %>% +drop_na() %>% +setNames(c('provincia', 'porcentaje')) %>% +filter(porcentaje != 1) +remesas_provincias <- readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +select(1:2) %>% +drop_na() %>% +setNames(c('provincia', 'porcentaje')) %>% +filter(porcentaje != 1) +usethis::use_data(remesas_provincias) +devtools::load_all(".") +DR_PROV +plot(DR_PROV) +library(sfDR) +DR_PROV_SF <- sf::st_as_sf(DR_PROV) +# Plotting the map of a specific province +plot(DR_PROV_SF) +DR_PROV_SF +DR_PROV_SF |> +dplyr::left_join(sfDR::remesas_provincias) +DR_PROV_SF |> +left_join(remesas_provincias, by = join_by('province' = 'PROV_NAME')) +DR_PROV_SF |> +left_join(remesas_provincias, by = join_by('PROV_NAME' = 'province')) +DR_PROV_SF |> +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) +DR_PROV_SF |> sf::st_drop_geometry() +library(dplyr) +DR_PROV_SF |> sf::st_drop_geometry() |> +left_join(dr_province) +.res <- DR_PROV_SF |> sf::st_drop_geometry() +.res |> +left_join(dr_province) +.res |> +left_join(dr_province, by = join_by(PROV_ID)) |> +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) +remesas_provincias +source("C:/Users/drdsd/Documents/Projects/Adatar/sfDR/data-raw/remesas_provincias.R") +remesas_provincias +quarto::quarto_preview_stop() +remesas_provincias <- readxl::read_excel('data-raw/Remesas_PR.xlsx', skip = 6) %>% +select(1:2) %>% +drop_na() %>% +setNames(c('province', 'percentage')) %>% +filter(percentage != 1) +source("C:/Users/drdsd/Documents/Projects/Adatar/sfDR/data-raw/remesas_provincias.R") +.res |> +left_join(dr_province, by = join_by(PROV_ID)) |> +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) +DR_PROV_SF |> +left_join(dr_province, by = join_by(PROV_ID)) |> +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) %>% +select(percetage) %>% +plot() +DR_PROV_SF |> +left_join(dr_province, by = join_by(PROV_ID)) |> +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) %>% +select(percentage) %>% +plot() +DR_PROV_SF %>% +sf::st_drop_geometry() +datos <- DR_PROV_SF |> +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) +DR_PROV_SF <- DR_PROV_SF |> +left_join(dr_province, by = join_by(PROV_ID)) +DR_PROV_SF %>% +sf::st_drop_geometry() +datos <- DR_PROV_SF |> +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) +datos %>% +sf::st_drop_geometry() +datos |> +select(percentage) %>% +plot() +library(ggplot2) +library(ggplot2) +DR_PROV %>% +sf::st_as_sf() %>% +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) %>% +ggplot() + +geom_sf(aes(fill = percentage)) +DR_PROV %>% +sf::st_as_sf() %>% +left_join(dr_province) %>% +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) %>% +ggplot() + +geom_sf(aes(fill = percentage)) +DR_PROV %>% +sf::st_as_sf() %>% +left_join(dr_province) %>% +left_join(remesas_provincias, by = join_by('PROV_NAME' == 'province')) %>% +ggplot() + +geom_sf(aes(fill = percentage)) + +theme_void() +rmarkdown::render("README.Rmd") +rmarkdown::render("README.Rmd") +rmarkdown::render("README.Rmd") diff --git a/DESCRIPTION b/DESCRIPTION index 2ae4a65..2e4fef5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: sfDR Title: Simple Features for Dominican Republic Administrative Boundaries -Version: 0.1.1 +Version: 0.1.2 Authors@R: c(person(given = "Daniel E.", family = "de la Rosa", diff --git a/_pkgdown.yml b/_pkgdown.yml index 4de4c90..291bce2 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -25,6 +25,7 @@ reference: contents: - DR_PROV - dr_province + - remesas_provincias - title: Municipalities desc: Functions and datasets for dealing with municipalities in the Dominican Republic. contents: