{"id":17795257,"url":"https://github.com/matt-dray/trapinch","last_synced_at":"2026-01-21T02:07:20.078Z","repository":{"id":65388680,"uuid":"587514722","full_name":"matt-dray/trapinch","owner":"matt-dray","description":":book::space_invader: R Package: get data from the PokéAPI service","archived":false,"fork":false,"pushed_at":"2023-02-05T10:57:31.000Z","size":275,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T13:36:16.727Z","etag":null,"topics":["pokeapi","pokemon","r-package"],"latest_commit_sha":null,"homepage":"https://www.rostrum.blog/2023/02/02/trapinch/","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/matt-dray.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}},"created_at":"2023-01-10T23:33:44.000Z","updated_at":"2023-05-28T01:55:01.000Z","dependencies_parsed_at":"2023-02-14T02:16:22.650Z","dependency_job_id":null,"html_url":"https://github.com/matt-dray/trapinch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/matt-dray/trapinch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Ftrapinch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Ftrapinch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Ftrapinch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Ftrapinch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matt-dray","download_url":"https://codeload.github.com/matt-dray/trapinch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Ftrapinch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28622473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T23:49:58.628Z","status":"online","status_checked_at":"2026-01-21T02:00:08.227Z","response_time":86,"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":["pokeapi","pokemon","r-package"],"created_at":"2024-10-27T11:25:16.212Z","updated_at":"2026-01-21T02:07:20.060Z","avatar_url":"https://github.com/matt-dray.png","language":"R","funding_links":[],"categories":[],"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, 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# {trapinch} \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.](https://www.repostatus.org/badges/latest/inactive.svg)](https://www.repostatus.org/#inactive)\n[![R-CMD-check](https://github.com/matt-dray/trapinch/workflows/R-CMD-check/badge.svg)](https://github.com/matt-dray/trapinch/actions)\n[![Codecov test coverage](https://codecov.io/gh/matt-dray/trapinch/branch/main/graph/badge.svg)](https://app.codecov.io/gh/matt-dray/trapinch?branch=main)\n[![Blog\npost](https://img.shields.io/badge/rostrum.blog-post-008900?labelColor=000000\u0026logo=data%3Aimage%2Fgif%3Bbase64%2CR0lGODlhEAAQAPEAAAAAABWCBAAAAAAAACH5BAlkAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAC55QkISIiEoQQQgghRBBCiCAIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAAh%2BQQJZAACACwAAAAAEAAQAAAC55QkIiESIoQQQgghhAhCBCEIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAA7)](https://www.rostrum.blog/2023/02/02/trapinch/)\n\u003c!-- badges: end --\u003e\n\nA simple R package to interface with [the PokéAPI service](https://pokeapi.co/), based on [{httr2}](https://httr2.r-lib.org/).\n\nWhy 'Trapinch'? Because [it's a Pokémon](https://bulbapedia.bulbagarden.net/wiki/Trapinch_(Pok%C3%A9mon)) whose name contains 'R API' and it wasn't claimed on [Repokemon](https://cheeaun.github.io/repokemon/) yet, lol.\n\n## Installation\n\nYou can install {trapinch} from GitHub with help from [{remotes}](https://remotes.r-lib.org/):\n\n```{r install, eval=FALSE}\nif (!require(remotes)) install.packages(\"remotes\")\nremotes::install_github(\"matt-dray/trapinch\")\n```\n\nThe package depends on R version 4.1 since it uses `R_user_dir()` and the base pipe, `|\u003e`.\n\n## Examples\n\nFunctions are all prefaced `get_*()` and return a list. The generic request function is `get_pokeapi()`, to which you can provide an `endpoint` and `resource` of interest. Each endpoint also has its own function to which you need only supply the resource of interest, like `get_pokemon()` or `get_type()`.\n\nFor example, retrieve a named Pokémon's details:\n\n```{r example-pokemon}\nbulba \u003c- trapinch::get_pokemon(\"bulbasaur\")\nbulba$moves[[1]]$move$name\n```\n\nOr retrieve an item's details:\n\n```{r example-item}\nball \u003c- trapinch::get_item(\"poke-ball\")\nball$flavor_text_entries[[1]]$text\n```\n\nIf you're wondering what endpoints and resources exist, you can find them in the `resource_lookups` list object. The endpoints:\n\n```{r endpoints}\nnames(trapinch::resource_lookups)\n```\n\nAnd an example resource table for Pokémon types:\n\n```{r resource}\nhead(trapinch::resource_lookups[[\"type\"]])\n```\n\nSee [the PokéAPI documentation](https://pokeapi.co/docs/v2) for full details of what can be returned.\n\n# Similar projects\n\nWrappers in several languages are named on [the PokéAPI website](https://pokeapi.co/docs/v2#wrap), but none are for R. I did find a couple of smaller-scale, non-{httr2} packages on GitHub: [UBC-MDS's {pokedex}](https://github.com/UBC-MDS/pokedex) and [Eva Nguyen's {pokeWrapper}](https://nguyeneva.github.io/2020-02-06-rwrapper/). I had, however, [overlooked](https://fosstodon.org/@ashbaldry/109806406291422128) an important one: [Ash Baldry](https://ashbaldry.github.io/) has already written the [{pokeapi} package](https://github.com/ashbaldry/pokeapi), which uses {httr2} and was released several months prior to {trapinch}. Whoops!\n\n# Thanks\n\nThis package was made easier with help from the:\n\n* [PokéAPI documentation](https://pokeapi.co/docs/v2)\n* [{httr2} documentation](https://httr2.r-lib.org/index.html)\n* [{httptest2} documentation](https://enpiar.com/httptest2/index.html)\n* [HTTP Testing book](https://books.ropensci.org/http-testing/) from rOpenSci\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-dray%2Ftrapinch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatt-dray%2Ftrapinch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-dray%2Ftrapinch/lists"}