Skip to content

Commit 95846dc

Browse files
committed
reverse the attempt to break out form and rely on 2 columns
order columns relatively intuitively remove habitat
1 parent 5f71825 commit 95846dc

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

data-raw/pokemon.R

+24-11
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ pokedex$pokemon %>%
6060
by = c("species_id" = "id"),
6161
suffix = c("_mon", "_species")
6262
) %>%
63-
rename("identifier" = "identifier_species", "default_form" = "identifier_mon") %>% # use species as it has simple name
64-
mutate(
65-
default_form = str_remove(default_form, ".*-") # remove the pokemon at the start
66-
) %>% #
6763
left_join(pokedex$pokemon_colors %>%
6864
rename("color" = "identifier"),
6965
by = c("color_id" = "id"),
@@ -74,12 +70,29 @@ pokedex$pokemon %>%
7470
by = c("shape_id" = "id"),
7571
suffix = c("", "_shape")) %>%
7672
select(-shape_id) %>%
77-
left_join(pokedex$pokemon_habitats %>%
78-
rename("habitat" = "identifier"),
79-
by = c("habitat_id" = "id"),
80-
suffix = c("", "_habitat")) %>%
81-
select(-habitat_id) %>%
82-
# convert integer value to metric decimal m and kg
83-
mutate_at(c("height", "weight"), ~ .x / 10) -> pokemon
73+
mutate_at(c("height", "weight"), ~ .x / 10) %>% # convert integer value to metric decimal m and kg
74+
select(id,
75+
name,
76+
identifier_species,
77+
identifier_mon,
78+
genus,
79+
color,
80+
shape,
81+
type_1,
82+
type_2,
83+
height,
84+
weight,
85+
base_experience,
86+
hp,
87+
attack,
88+
defense,
89+
special_attack,
90+
special_defense,
91+
speed,
92+
flavour_text,
93+
generation_id,
94+
evolves_from_species_id,
95+
evolution_chain_id
96+
) -> pokemon
8497

8598
usethis::use_data(pokemon, overwrite = TRUE)

data/pokemon.rda

-3.03 KB
Binary file not shown.

0 commit comments

Comments
 (0)