{"id":13423624,"url":"https://github.com/dcooley/geometries","last_synced_at":"2025-08-03T14:32:50.409Z","repository":{"id":52215812,"uuid":"259277527","full_name":"dcooley/geometries","owner":"dcooley","description":"R package for creating and manipulating geometric data structures","archived":false,"fork":false,"pushed_at":"2024-02-06T13:13:39.000Z","size":339,"stargazers_count":28,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-21T22:19:26.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dcooley.github.io/geometries/","language":"C++","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/dcooley.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null},"funding":{"github":["dcooley"]}},"created_at":"2020-04-27T10:14:29.000Z","updated_at":"2024-01-17T05:04:54.000Z","dependencies_parsed_at":"2024-01-02T09:55:41.966Z","dependency_job_id":"de13d6f1-d971-43d5-b17a-967045ae1d5c","html_url":"https://github.com/dcooley/geometries","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/dcooley/geometries","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcooley%2Fgeometries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcooley%2Fgeometries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcooley%2Fgeometries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcooley%2Fgeometries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcooley","download_url":"https://codeload.github.com/dcooley/geometries/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcooley%2Fgeometries/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261282035,"owners_count":23134925,"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":[],"created_at":"2024-07-31T00:00:39.128Z","updated_at":"2025-06-26T17:32:31.506Z","avatar_url":"https://github.com/dcooley.png","language":"C++","readme":"---\noutput: github_document\neditor_options: \n  chunk_output_type: console\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n\nlibrary(geometries)\n```\n\n# geometries\n\n[![R build status](https://github.com/dcooley/geometries/workflows/R-CMD-check/badge.svg)](https://github.com/dcooley/geometries/actions)\n[![Codecov test coverage](https://codecov.io/gh/dcooley/geometries/branch/master/graph/badge.svg)]( https://app.codecov.io/gh/dcooley/geometries?branch=master)\n\nHave you every wanted to generate geometric structures from data.frames, but independent of any R classes, attributes or libraries? \n\nNo? Ok, this library isn't for you.\n\nBut if you answered 'yes', this might be of interest.\n\n## What is the point?\n\nWhen one thinks of 'shape' objects in R, the current standard / typical structures are\n\n- **Point** - a vector of x, y values\n- **Line** - a matrix of x, y columns\n- **Polygon** - a list of matrices of x, y columns\n- **MultiPolygon** - a list of list of matrices of x, y columns\n\n(in reality you can have more than just x \u0026 y columns)\n\nBut constructing these can sometimes be a bit fiddly. \n\nSo my **goal** of this package is to take away the pain of building **shapes**. I want to accept **any** base R data object and convert it into the required **shape**\n\n## Some Examples\n\nTake a `data.frame`\n\n```{r}\ndf \u003c- data.frame(\n  id = c(1,1,1,1,1,2,2,2,2,2)\n  , x = 1:10\n  , y = 10:1\n)\ndf\n```\n\nYou can make two \"LINE\"* objects by splitting this into a list of matrices\n\n```{r}\ngm_geometries(\n  obj = df\n  , geometry_cols = c(\"x\",\"y\")\n  , id_cols = c(\"id\")\n)\n```\n\n*I've put \"LINE\" in quotes because this doesn't _have_ to be called a LINE, it's just that a LINE is typically represented by a matrix in R.\n\nAnd if you send it a `class_attribute`, you can make it into whatever type of object you want\n\n```{r}\ngm_geometries(\n  obj = df\n  , geometry_cols = c(\"x\",\"y\")\n  , id_cols = c(\"id\")\n  , class_attributes = list(class = \"my_new_shape\", other = \"really_awesome_shape\")\n)\n\n```\n\n\nAnd I'm building it as an **interface** package. That is, it's all being written in C++ header files, so you can link to these header files from your own package.\n\n## What do you mean, 'link to'?\n\nWhen you build a package, if you want to use C++ code from **another package**, you have to let the compiler know. In an R package, you do this by specifying a `LinkingTo` value in the DESCRIPTION.\n\nTake for example, the [LinkingTo](https://github.com/dcooley/geometries/blob/master/DESCRIPTION#L17) section in the DESCRIPTION field of this package\n\n```yaml\nSystemRequirements: C++11\nLinkingTo: \n    Rcpp\nImports:\n    Rcpp\n```\n\nThis tells the compiler I want to link to Rcpp's. Which means I can use all the [Rcpp code](https://github.com/RcppCore/Rcpp/tree/master/inst/include/Rcpp) by including whichever header file I want.\n\n\n\n\n\n\n","funding_links":["https://github.com/sponsors/dcooley"],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcooley%2Fgeometries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcooley%2Fgeometries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcooley%2Fgeometries/lists"}