{"id":13858005,"url":"https://github.com/hrbrmstr/spdorling","last_synced_at":"2025-10-29T01:30:49.459Z","repository":{"id":141238811,"uuid":"135761045","full_name":"hrbrmstr/spdorling","owner":"hrbrmstr","description":"🗺 Create Dorling Cartograms from Contiguous Region Shapefiles","archived":false,"fork":false,"pushed_at":"2018-06-02T18:58:41.000Z","size":319,"stargazers_count":19,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-06T03:04:52.576Z","etag":null,"topics":["cartogram","dorling","dorling-cartogram","r","rstats","spatial"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrbrmstr.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-06-01T20:35:06.000Z","updated_at":"2023-08-30T09:55:46.000Z","dependencies_parsed_at":"2024-02-09T02:08:24.489Z","dependency_job_id":null,"html_url":"https://github.com/hrbrmstr/spdorling","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspdorling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspdorling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspdorling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspdorling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrbrmstr","download_url":"https://codeload.github.com/hrbrmstr/spdorling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219858513,"owners_count":16556043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cartogram","dorling","dorling-cartogram","r","rstats","spatial"],"created_at":"2024-08-05T03:01:53.737Z","updated_at":"2025-10-29T01:30:44.121Z","avatar_url":"https://github.com/hrbrmstr.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: rmarkdown::github_document\n---\n\n# spdorling\n\nCreate Dorling Cartograms from Contiguous Region Shapefiles\n\n## Description\n\nCreate Dorling Cartograms from Contiguous Region Shapefiles\n\n## What's Inside The Tin\n\n- `dorling_from_sp`:\tCompute center coordinates, circle radii and Dorling polygons from input polygons and values\n\nThe following functions are implemented:\n\n## Installation\n\n```{r eval=FALSE}\ndevtools::install_github(\"hrbrmstr/spdorling\")\n```\n\n```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}\noptions(width=120)\nknitr::opts_chunk$set(fig.retina=2)\n```\n\n## Usage\n\n```{r message=FALSE, warning=FALSE, error=FALSE}\nlibrary(spdorling)\n\n# current verison\npackageVersion(\"spdorling\")\n\n```\n\n### Lower 48 U.S.A.\n\n```{r message = FALSE}\nlibrary(albersusa) # hrbrmstr/albersusa\nlibrary(hrbrthemes)\nlibrary(tidyverse)\n\nusa \u003c- albersusa::usa_composite(proj = \"laea\")\nusa \u003c- subset(usa, !(name %in% c(\"Alaska\", \"Hawaii\", \"District of Columbia\")))\n\nset.seed(2018)\nusa$val \u003c- sample(10000, 48)\n\ndor \u003c- dorling_from_sp(usa, value=usa$val, quiet=FALSE)\n\ndiscs_df \u003c- fortify(dor$discs)\n\nas_data_frame(dor$xy) %\u003e% \n  set_names(c(\"lng\", \"lat\")) %\u003e% \n  mutate(iso2c = usa$iso_3166_2) -\u003e usa_labs\n\nggplot() +\n  geom_polygon(\n    data = discs_df, aes(long, lat, group=group), \n    size=0.125, color=\"#2b2b2b\", fill=\"#00000000\"\n  ) +\n  geom_text(data = usa_labs, aes(lng, lat, label=iso2c), size=2) +\n  coord_fixed() +\n  labs(x=NULL, y=NULL) +\n  theme_ipsum_rc(grid=\"\") +\n  theme(axis.text=element_blank())\n```\n\n### Swiss Cantons\n\n```{r}\nlibrary(sp)\nlibrary(rgdal)\n\nreadOGR(\n  system.file(\"extdat\", \"swiss-cantons.json\", package=\"spdorling\"),\n  verbose = FALSE,\n  stringsAsFactors = FALSE\n) -\u003e cantons\n\n# convert it to equal area\nSpatialPolygonsDataFrame(\n  spTransform(cantons, CRS(\"+proj=aea +lat_1=45.96 +lat_2=47.50 +lon_0=8.34\")),\n  data = cantons@data\n) -\u003e cantons\n\nset.seed(2018)\ncantons$val \u003c- sample(10000, nrow(cantons@data))\n\ndor \u003c- dorling_from_sp(cantons, value=cantons$val, quiet=FALSE)\n\ndiscs_df \u003c- fortify(dor$discs)\n\nas_data_frame(dor$xy) %\u003e% \n  set_names(c(\"lng\", \"lat\")) %\u003e% \n  mutate(name = cantons$name) -\u003e cantons_labs\n\nggplot() +\n  geom_polygon(\n    data = discs_df, aes(long, lat, group=group), \n    size=0.125, color=\"#2b2b2b\", fill=\"#00000000\"\n  ) +\n  geom_text(data = cantons_labs, aes(lng, lat, label=name), size=2) +\n  coord_fixed() +\n  labs(x=NULL, y=NULL) +\n  theme_ipsum_rc(grid=\"\") +\n  theme(axis.text=element_blank())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fspdorling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrbrmstr%2Fspdorling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fspdorling/lists"}