The pokedex package offers a suite of functions allowing a user to interact with the PokeAPI. Information about berries, evolutions, regions, and game generations is viewable.

Functions available include:

Installation

The package can be installed from GitHub using,

devtools::install_github("UBC-MDS/pokedex")

Usage

All functions perform similarly, taking a string specifying a pokemon or berry name, type, or relationship.

For example, information about any berry can be found as follows:

get_berry("cheri")

Note that a message will be returned if the name isn't in the PokeAPI database. Berry names must be in lowercase. A dataframe of available berries can be found by loading,

data(berry_lookup)

Users can also access information about type effectiveness. If a user wanted to know which types fire is strong against, the following will return that information,

type_effectiveness("fire", "strong", "against")

Users can access the evolution tree for baby pokemon. If a user wants to know which pokemon Bulbasaur evolves into, the following will return the trigger and minimum level the user must reach to evolve:

evolution_tree("bulbasaur")

Examples

A simple example of how to generate plots:

# devtools::install_github("UBC-MDS/pokedex")

suppressPackageStartupMessages(library(tidyverse))
library(pokedex)

# easy to generate plots with
get_types("berry") %>% 
  map_dfr(get_berry) %>% 
  mutate(Name = forcats::fct_reorder(Name, Size)) %>% 
  ggplot() +
  geom_point(aes(x = Size, y = Name)) +
  ggtitle("BERRY SIZES")

Or simply get some information:

get_types("version", limit = 25) %>% 
  map_dfr(get_region)


UBC-MDS/pokedex documentation built on May 30, 2019, 11:41 a.m.