@@ -60,10 +60,6 @@ pokedex$pokemon %>%
60
60
by = c(" species_id" = " id" ),
61
61
suffix = c(" _mon" , " _species" )
62
62
) %> %
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
- ) %> % #
67
63
left_join(pokedex $ pokemon_colors %> %
68
64
rename(" color" = " identifier" ),
69
65
by = c(" color_id" = " id" ),
@@ -74,12 +70,29 @@ pokedex$pokemon %>%
74
70
by = c(" shape_id" = " id" ),
75
71
suffix = c(" " , " _shape" )) %> %
76
72
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
84
97
85
98
usethis :: use_data(pokemon , overwrite = TRUE )
0 commit comments