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:
get_berry
evolution_tree
get_berry
get_types
type_effectiveness
The package can be installed from GitHub using,
devtools::install_github("UBC-MDS/pokedex")
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")
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.