{"id":13857746,"url":"https://github.com/cenuno/pointdexter","last_synced_at":"2025-07-13T22:31:14.247Z","repository":{"id":193752347,"uuid":"164377756","full_name":"cenuno/pointdexter","owner":"cenuno","description":"Label longitudinal and latitudinal coordinates located inside a polygon.","archived":false,"fork":false,"pushed_at":"2019-03-17T06:26:46.000Z","size":11888,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-11-22T15:41:20.458Z","etag":null,"topics":["points","polygon","polygons","r","spatial-analysis","spatial-statistics"],"latest_commit_sha":null,"homepage":"https://cenuno.github.io/pointdexter/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cenuno.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-01-07T04:22:13.000Z","updated_at":"2022-02-22T20:33:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"5baf8ecb-003d-4838-9db5-52773f8a010d","html_url":"https://github.com/cenuno/pointdexter","commit_stats":null,"previous_names":["cenuno/pointdexter"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cenuno/pointdexter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenuno%2Fpointdexter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenuno%2Fpointdexter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenuno%2Fpointdexter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenuno%2Fpointdexter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cenuno","download_url":"https://codeload.github.com/cenuno/pointdexter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenuno%2Fpointdexter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265218201,"owners_count":23729496,"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":["points","polygon","polygons","r","spatial-analysis","spatial-statistics"],"created_at":"2024-08-05T03:01:45.697Z","updated_at":"2025-07-13T22:31:12.600Z","avatar_url":"https://github.com/cenuno.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(collapse = TRUE\n                      , comment = \"#\u003e\"\n                      , fig.path = \"man/figures/README-\"\n                      , out.width = \"100%\"\n                      , dpi = 300)\n```\n\n# pointdexter \u003cimg src=\"man/figures/logo.png\" align=\"right\" alt=\"\" width=\"140\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/pointdexter)](https://cran.r-project.org/package=pointdexter)\n[![CRAN checks](https://cranchecks.info/badges/worst/pointdexter)](https://cran.r-project.org/web/checks/check_results_pointdexter.html)\n[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/pointdexter?color=brightgreen)](http://www.r-pkg.org/pkg/pointdexter)\n[![Rdoc](http://www.rdocumentation.org/badges/version/pointdexter)](http://www.rdocumentation.org/packages/pointdexter) \n[![Travis build status](https://travis-ci.org/cenuno/pointdexter.svg?branch=master)](https://travis-ci.org/cenuno/pointdexter)\n\u003c!-- badges: end --\u003e\n\nThe `pointdexter` package labels longitudinal and latitudinal coordinates located inside a polygon. \n\n## Description\n\nFor a singular polygon, the label for each coordinate pair is a logical vector of TRUE and FALSE values. For multiple polygons, the label for each coordinate pair is a character vector based on the names of each polygon. \n\n## Spatial Packages\n\nThe package is designed to work with both [sf](https://r-spatial.github.io/sf/) and [SpatialPolygonsDataFrame](https://www.rdocumentation.org/packages/sp/versions/1.2-5/topics/SpatialPolygonsDataFrame-class) objects.\n\nBy default, `pointdexter` only installs and loads the [`sp`](https://www.rdocumentation.org/packages/sp/versions/1.3-1) and [`splancs`](https://www.rdocumentation.org/packages/splancs/versions/2.01-40) packages. \n\nHowever, `pointdexter` also works with the [`sf`](https://www.rdocumentation.org/packages/sf/versions/0.7-2) package. The following is `sf` installation advice from [Matt Herman](https://nycgeo.mattherman.info/):\n\n\u003e Depending on your operating system and available libraries, `sf` can be tricky to install the first time. The [`sf` website](https://r-spatial.github.io/sf/index.html#installing) is a good place to start if you're having trouble. If you're using macOS, [this is a good guide](https://medium.com/@jinwujour/mapping-with-r-on-mac-installation-8c8ef997c6c2) to installing the required libraries.\n\n## Installation\n\nThe latest stable release version can be installed from [CRAN](https://cran.r-project.org/package=pointdexter):\n\n```R\ninstall.packages(\"pointdexter\")\n```\n\nDevelopment versions can be installed from GitHub:\n\n```R\n# note: by default, the development version is the master branch;\n#       however, that can be changed by changing the \n#       value in the 'ref' argument\nremotes::install_github(\"cenuno/pointdexter\")\n```\n\n## Usage\n\n### Build-in Data\n\n`pointdexter` comes with built-in point and polygon data - entirely due to the awesome and accessible [Chicago Data Portal](https://data.cityofchicago.org/) - to help you label points in polygons:\n\n* Chicago Public Schools (CPS) - [School Profile Information, School Year (SY) 2018-2019](https://data.cityofchicago.org/Education/Chicago-Public-Schools-School-Profile-Information-/kh4r-387c)\n    + as a data frame\n\n* City of Chicago [boundary](https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-City/ewy2-6yfk)\n    + as a SpatialPolygonsDataFrame; and\n    + as a simple feature\n    \n* Chicago's [77 community areas](https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Community-Areas-current-/cauq-8yn6)\n    + as a SpatialPolygonsDataFrame; and\n    + as a simple feature\n    \n* Chicago's [2010 census tracts](https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Census-Tracts-2010/5jrd-6zik)\n    + as a SpatialPolygonsDataFrame; and\n    + as a simple feature\n    \n### Example\n\nUsing built-in data, down below is an example of how to use `pointdexter` to label coordinate pairs with their appropriate polygon:\n\n```{r example}\n# load necessary packages ----\nlibrary(pointdexter) # label coordinate pairs in polygons\nlibrary(sp)          # classes and methods for spatial data\nlibrary(knitr)       # general purpose package for dynamic report generation\n\n# load necessary data ----\ndata(\"cps_sy1819\")\ndata(\"community_areas_spdf\")\n\n# create list of coordinate pair matrices for each community area ----\ncommunity.area.boundaries \u003c-\n  GetPolygonBoundaries(my.polygon = community_areas_spdf\n                       , labels = community_areas_spdf$community)\n\n# identify the community that each cps school lies in ----\ncps_sy1819$community \u003c-\n  LabelPointsWithinPolygons(lng = cps_sy1819$school_longitude\n                            , lat = cps_sy1819$school_latitude\n                            , polygon.boundaries = community.area.boundaries)\n\n# store relevant columns ----\nrelevant.columns \u003c-\n  c(\"school_id\", \"short_name\"\n    , \"school_longitude\", \"school_latitude\", \"community\")\n\n# show first few records ----\nkable(head(cps_sy1819[, relevant.columns], n = 10))\n```\n\n```{r visualize}\n# plot only CPS high schools in the the Austin, Rogers Park, and West Elsdon community areas ----\n\n# create filter condition ----\nfilter.condition \u003c- \n  which(cps_sy1819$is_high_school \u0026\n          cps_sy1819$community %in% c(\"AUSTIN\"\n                                      , \"ROGERS PARK\"\n                                      , \"WEST ELSDON\"))\n\n# filter cps records to those that matched our condition ---\ndf \u003c- cps_sy1819[filter.condition, ]\n\n# note: clear plot space\npar(mar = c(0, 0, 1, 0))\nplot(x = community_areas_spdf\n     , main = \"CPS High Schools in Austin, Rogers Park, and West Elsdon communities, SY1819\"\n     , cex.main = 0.75\n     , col = \"gray85\"\n     , border = \"dodgerblue4\")\npoints(x = df$school_longitude\n       , y = df$school_latitude\n       , pch = 19\n       , col = rgb(red = 212, green = 69, blue = 0\n                   , alpha = 90\n                   , maxColorValue = 255)\n       , cex = 1)\n\n# store relevant columns ----\nrelevant.columns \u003c-\n  c(\"school_id\", \"short_name\", \"is_high_school\"\n    , \"school_longitude\", \"school_latitude\", \"community\")\n\n# print table of those schools that met the condition ----\nkable(df[order(df$community), relevant.columns], row.names = FALSE)\n\n```\n\n## Resources\n\nAfter you've installed the package, be sure to view the help files that introduce you to `pointdexter`'s two functions:\n\n1. [`?pointdexter::GetPolygonBoundaries()`](https://cenuno.github.io/pointdexter/reference/GetPolygonBoundaries.html); and\n2. [`?pointdexter::LabelPointsWithinPolygons()`](https://cenuno.github.io/pointdexter/reference/LabelPointsWithinPolygons.html).\n\n## Feedback\n\n### Cite\n\nIf you use `pointdexter` for any analysis, I would love to hear about it! You can also cite the package according to `citation(\"pointdexter\")`.\n\n### Contribute\n\n[Issues](https://github.com/cenuno/pointdexter/issues) and [pull requests](https://github.com/cenuno/pointdexter/pulls) are welcome anytime!\n\n## Code of Conduct\n\nPlease note that this project is released with a [Contributor Code of Conduct](.github/CODE_OF_CONDUCT.md).\nBy participating in this project you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenuno%2Fpointdexter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcenuno%2Fpointdexter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenuno%2Fpointdexter/lists"}