{"id":19891876,"url":"https://github.com/inbo/grtsdb","last_synced_at":"2026-04-19T03:02:16.310Z","repository":{"id":55080235,"uuid":"185938353","full_name":"inbo/grtsdb","owner":"inbo","description":"Spatially balanced sampling based on the General Randomized Tessellation Stratified (GRTS) using R and SQLite","archived":false,"fork":false,"pushed_at":"2022-01-10T10:28:34.000Z","size":451,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-03-28T04:36:02.663Z","etag":null,"topics":["grts","r","r-package","r-stats","sampling","sampling-methods","sqlite"],"latest_commit_sha":null,"homepage":"https://inbo.github.io/grtsdb/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inbo.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":".zenodo.json"}},"created_at":"2019-05-10T07:16:17.000Z","updated_at":"2022-01-09T20:00:11.000Z","dependencies_parsed_at":"2022-08-14T11:20:56.212Z","dependency_job_id":null,"html_url":"https://github.com/inbo/grtsdb","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/inbo/grtsdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inbo%2Fgrtsdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inbo%2Fgrtsdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inbo%2Fgrtsdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inbo%2Fgrtsdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inbo","download_url":"https://codeload.github.com/inbo/grtsdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inbo%2Fgrtsdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31992822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["grts","r","r-package","r-stats","sampling","sampling-methods","sqlite"],"created_at":"2024-11-12T18:19:58.381Z","updated_at":"2026-04-19T03:02:16.225Z","avatar_url":"https://github.com/inbo.png","language":"R","readme":"---\noutput: github_document\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 = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# grtsdb\n\n\u003c!-- badges: start --\u003e\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n![GitHub](https://img.shields.io/github/license/inbo/grtsdb)\n[![R build status](https://github.com/inbo/grtsdb/workflows/R-CMD-check/badge.svg)](https://github.com/inbo/grtsdb/actions)\n[![Codecov test coverage](https://codecov.io/gh/inbo/grtsdb/branch/master/graph/badge.svg)](https://app.codecov.io/gh/inbo/grtsdb?branch=master)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/inbo/grtsdb.svg)\n![GitHub repo size](https://img.shields.io/github/repo-size/inbo/grtsdb.svg)\n\u003c!-- badges: end --\u003e\n\nThe goal of `grtsdb` is to create a spatially balanced sample based on the 'Generalised Random Tesselation Stratified' strategy.\nWe store the base schema in an SQLite database to make the sampling reproducible.\nSampling the same database with the same parameters yields a stable sample.\n\n## Installation\n\nTo install the latest stable version use\n\n``` r\n# activate the INBO r-universe\noptions(\n  repos = c(\n    INBO = 'https://inbo.r-universe.dev', CRAN = 'https://cloud.r-project.org'\n  )\n)\ninstall.packages(\"grtsdb\")\n```\n\nYou can install the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"inbo/grtsdb\")\n```\n\n## Example\n\nThis is a basic example.\n\nConnect to a database.\n\n```{r}\ntmp_copy \u003c- tempfile(pattern = \"grts\", fileext = \".sqlite\")\nif (system.file(\"grts.sqlite\", package = \"grtsdb\") != \"\") {\n  file.copy(system.file(\"grts.sqlite\", package = \"grtsdb\"), tmp_copy)\n}\nlibrary(grtsdb)\ndb \u003c- connect_db(tmp_copy)\n```\n\nTo extract a sample, you'll need to specify the bounding box in projected coordinates and the size of the grid cells.\n\n```{r example}\nbbox \u003c- rbind(\n  c(0, 32),\n  c(0, 32)\n)\nextract_sample(grtsdb = db, samplesize = 10, bbox = bbox, cellsize = 1)\n```\n\nRepeating the sample yields the same results.\n\n```{r}\nextract_sample(grtsdb = db, samplesize = 10, bbox = bbox, cellsize = 1)\n```\n\n```{r echo = FALSE}\ndrop_legacy_sites(grtsdb = db, level = 5)\n```\n\nYou can add legacy sites to the sampling scheme.\n\n```{r}\nlegacy \u003c- rbind(\n  c(4, 4),\n  c(17, 6)\n)\nadd_legacy_sites(legacy, bbox = bbox, cellsize = 1, grtsdb = db)\nextract_legacy_sample(grtsdb = db, samplesize = 10, bbox = bbox, cellsize = 1)\n```\n\nYou can compact the database for storage.\n\n```{r}\ncompact_db(db)\n```\n\nDisconnect the database when done.\n\n```{r}\ndbDisconnect(db)\n```\n\n```{r eval = system.file(\"grts.sqlite\", package = \"grtsdb\") == \"\", echo = FALSE}\ndir.create(\"inst\", showWarnings = FALSE)\nfile.copy(tmp_copy, file.path(\"inst\", \"grts.sqlite\"))\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finbo%2Fgrtsdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finbo%2Fgrtsdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finbo%2Fgrtsdb/lists"}