Column Details of the data set:
#: PokeDex index number
Name: Name of the Pokemon
Type 1: Type of pokemon
Type 2: Second Type of Pokemon
Total: Sum of Attack, Sp. Atk, Defense, Sp. Def, Speed and HP
HP: Hit Points
Attack: Attack Strength
Defense: Defensive Strength
Sp. Atk: Special Attack Strength
Sp. Def: Special Defensive Strength
Speed: Speed
Generation: Number of generation
Legendary: True if Legendary Pokemon False if not (more revision on mythical vs legendary needed)
Reason and aim of the analysis
In this analysis, real pokemon world rules will be applied, and 3 pokemons is given at the beginning of the game, and we’re able to pick just one of them. Those pokemons are Bulbasaur, Squirtle, Charmander. After choosing our pokemon, we can start the game. The aim of the game is catching new pokemons, and enhancing the portfolio. We are able to catch up to 6 pokemons. After winning the fight, if we want and prefer, we can take that pokemon to our portfolio.
But the most important part to pick the best pokemon to start! We investigate based on pokemon’s type and average power of those types. Let’s play the game, and dive into data.
Graph 1
library(magrittr)
legendary.analysis <- Pokemon %>%
group_by(Legendary) %>%
summarize(attack=mean(Attack),
defense=mean(Defense),
hp=mean(HP),
sp.atk=mean(`Sp. Atk`),
sp.def=mean(`Sp. Def`),
speed=mean(Speed))
legendary.analysis
## # A tibble: 2 x 7
## Legendary attack defense hp sp.atk sp.def speed
## <lgl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 FALSE 75.7 71.6 67.2 68.5 68.9 65.5
## 2 TRUE 117. 99.7 92.7 122. 106. 100.
d <- melt(legendary.analysis,id.vars="Legendary")
ggplot(d, aes(Legendary,value, col=variable)) +
geom_point() +
stat_smooth() +
ylab("Means of Stats") +
xlab("Legendary or not")

Legendary is a stat that is indicating whether Pokemons are legendary or not. In this analysis, we calculated the mean of all stats of pokemons to see the power differences between legendary and non-legendary pokemons. We clearly see that legendary pokemons are more powerful than non-legendary pokemons in attack, defense, HP, special attack, special defense. But the pokemons which are given us at the beginning of the game are non-legendary, so that’s why we’ll not include the legendary pokemons while choosing our initial pokemon. But, to take the control over the pokemon worlds we also must be able to gain the fight against the legendary pokemon. So, we’ll first choose the best pokemon to initialize the game, then create a logical path to capture legendary pokemons.
Graph 2
colors <- c("cyan","bisque","brown","coral","dodgerblue","gainsboro","gold",
"darkorchid","chartreuse","aquamarine","blue","black","darkorange",
"seagreen","salmon","red","palevioletred","palegreen")
ggplot(Pokemon,
aes(x=reorder(`Type 1`,`Type 1`,
function(x)-length(x)))) +
geom_bar(fill=colors,col='black')+
scale_y_continuous(limits=c(0,120))+
ylab("Count") +
xlab("Type 1 of Non-Legendary Pokemons")

In this analysis, we created a histogram to show the distribution of Type 1 of non-legendary pokemons. As we said before, we just are just able to select one pokemon among three pokemons. That’s why we’ll pick a pokemon which has supremacy as a type over Water, Normal, Grass and Bug types pokemon. It will give more probability to win in a fight. Pokemon game has already had an rule for power of types over other types. We’ll use this information later (source: “https://pokemondb.net/type”). For instance, water type has double power over fire type when water type is on the attack side, but fire type has ½ power when water type is on the defense side. The pokemon that we’ll choose has to be more powerful over those types.
Graph 3
colors2 <- c("cyan","bisque","brown","coral","dodgerblue","gainsboro","gold",
"darkorchid","chartreuse","aquamarine","blue","black","darkorange",
"seagreen","salmon","red","palevioletred","palegreen","green")
ggplot(data = Pokemon,
aes(x=reorder(`Type 2`,`Type 2`,
function(x)-length(x)))) +
geom_bar(fill=colors2,col='black') +
scale_y_continuous(limits=c(0,400)) +
ylab("Count") +
xlab("Type 2 of Non-Legendary Pokemons")

Some pokemon also has Type 2. In this graph, we clearly see that almost 50% of all data is N/A, means that 50% of pokemon hasn’t got type 2. But we should consider pokemons that have Flying type on their Type 2. When we use this (“https://pokemondb.net/type”) information to choose our initial pokemon, we should pick the pokemon which has supremacy also over Flying type. I want to repeat our strategy and reason for those last 2 graphs. We want to pick a pokemon has the supremacy over more pokemons.
Graph 4
a.fire.advantage <- Pokemon[(Pokemon$`Type 1`=='Grass') |
(Pokemon$`Type 1`=='Ice') |
(Pokemon$`Type 1`=='Bug') |
(Pokemon$`Type 1`=='Steel'),]
a.fire.advantage$advantage <- "AttackAdvantage"
a.water.advantage <- Pokemon[(Pokemon$`Type 1`=='Fire') |
(Pokemon$`Type 1`=='Ground') |
(Pokemon$`Type 1`=='Rock') ,]
a.water.advantage$advantage <- "AttackAdvantage"
a.grass.advantage <- Pokemon[(Pokemon$`Type 1`=='Water') |
(Pokemon$`Type 1`=='Ground') |
(Pokemon$`Type 1`=='Rock') ,]
a.grass.advantage$advantage <- "AttackAdvantage"
a.poison.advantage <- Pokemon[(Pokemon$`Type 1`=='Grass') |
(Pokemon$`Type 1`=='Fairy'),]
a.poison.advantage$advantage <- "AttackAdvantage"
d.fire.advantage <- Pokemon[(Pokemon$`Type 1`=='Grass') |
(Pokemon$`Type 1`=='Ice') |
(Pokemon$`Type 1`=='Bug') |
(Pokemon$`Type 1`=='Steel') |
(Pokemon$`Type 1`=='Fairy'),]
d.fire.advantage$advantage <- "DefenseAdvantage"
d.water.advantage <- Pokemon[(Pokemon$`Type 1`=='Fire') |
(Pokemon$`Type 1`=='Ice') |
(Pokemon$`Type 1`=='Steel'),]
d.water.advantage$advantage <- "DefenseAdvantage"
d.grass.advantage <- Pokemon[(Pokemon$`Type 1`=='Water') |
(Pokemon$`Type 1`=='Electric') |
(Pokemon$`Type 1`=='Ground'),]
d.grass.advantage$advantage <- "DefenseAdvantage"
d.poison.advantage <- Pokemon[(Pokemon$`Type 1`=='Grass') |
(Pokemon$`Type 1`=='Fighting') |
(Pokemon$`Type 1`=='Bug') |
(Pokemon$`Type 1`=='Fairy'),]
d.poison.advantage$advantage <- "DefenseAdvantage"
PokemonAdvantage <- rbind(a.fire.advantage,d.fire.advantage)
PokemonAdvantage2 <- rbind(a.water.advantage,d.water.advantage)
PokemonAdvantage3 <- rbind(a.grass.advantage,d.grass.advantage,a.poison.advantage,d.poison.advantage)
colors.advantage <- c("red","blue")
g1 <- ggplot(PokemonAdvantage,aes(x=advantage)) +
geom_bar(fill=colors.advantage,col='black') +
scale_y_continuous(limits = c(0,400))+
ylab("Count") +
xlab("Charmander Advantages")+
theme(axis.text.x = element_text(angle = 90, hjust = 1))
g2 <- ggplot(PokemonAdvantage2,aes(x=advantage)) +
geom_bar(fill=colors.advantage,col='black')+
scale_y_continuous(limits = c(0,400))+
ylab("") +
xlab("Squirtle Advantages")+
theme(axis.text.x = element_text(angle = 90, hjust = 1))
g3 <- ggplot(PokemonAdvantage3,aes(x=advantage)) +
geom_bar(fill=colors.advantage,col='black')+
scale_y_continuous(limits = c(0,400)) +
ylab("") +
xlab("Balbasaur Advantages")+
theme(axis.text.x = element_text(angle = 90, hjust = 1))
grid.arrange(g1,g2,g3,nrow=1)

We used the information from this (“https://pokemondb.net/type”) resources. We firstly wrote down the pokemons that have attack and defense disadvantages over Bulbasaur,Charmander, and Squirtle. Then visualize that data. As a result, Squirtle has type advantages over less pokemons, but Bulbasaur has type advantages over more pokemons because Bulbasaur also have type 2 rather Squirtle and Charmander. Type advantages take us to choose Bulbasaur! But we need to investigate also their stats.
Graph 5
power.analysis <- Pokemon %>%
group_by(`Type 1`) %>%
summarize(attack=mean(Attack),
defense=mean(Defense),
hp=mean(HP),
sp.atk=mean(`Sp. Atk`),
sp.def=mean(`Sp. Def`),
speed=mean(Speed))
d <- melt(power.analysis,id.vars="Type 1")
ggplot(d, aes(`Type 1`,value, col=variable)) +
geom_point() +
stat_smooth() +
ylab("Means of Stats") +
xlab("Non-Legendary Pokemons Type 1")

The graph shows means of Attack, Defense, Special Attack, Special Defense, Speed for each type of non-legendary pokemon. We already know that Water, Normal, Grass and Bug types are the most ones from second graph. When we look at the average power of those pokemons, they’re at the down in the graph. This again validate our type strategy! Their average power are not better than the average, even worse. Bulbasaur is again approved by this analysis. Because it has double to grass with its Type 2, and double to water with its Type 1. This again comes from this matrix (“https://pokemondb.net/type”)
Graph 6
colors <- c("cyan","bisque","brown","coral","dodgerblue","gainsboro","gold",
"darkorchid","chartreuse","aquamarine","blue","black","darkorange",
"seagreen","salmon")
ggplot(Pokemon[Pokemon$Legendary == 'TRUE',],
aes(x=reorder(`Type 1`,`Type 1`,
function(x)-length(x)))) +
geom_bar(fill=colors,col='black')+
scale_y_continuous(limits=c(0,20)) +
ylab("Count") +
xlab("Legendary Pokemons Type 1")

We picked the Bulbasaur based on our Exploratory Data Analysis, but what about our further strategy ? As we said before, we did not include the legendary pokemons! Because, they are already so powerful, and we couldn’t even think to come across with them. But in the pokemon world, pokemons get stronger after each fight, and if pokemon wins the fight, they have the other pokemon that it fight.
So, this graph shows the distribution of Type 1 of Legendary pokemons. We should have fight with pokemons by considering this distribution. Because if we have pokemons which have type powers on Psychic and Dragon, we have more opportunity get more legendary pokemons!
Graph 7
power.legend.analysis <- Pokemon[Pokemon$Legendary == 'TRUE',] %>%
group_by(`Type 1`) %>%
summarize(attack=mean(Attack),
defense=mean(Defense),
hp=mean(HP),
sp.atk=mean(`Sp. Atk`),
sp.def=mean(`Sp. Def`),
speed=mean(Speed))
d <- melt(power.legend.analysis,id.vars="Type 1")
ggplot(d, aes(`Type 1`,value, col=variable)) +
geom_point() +
stat_smooth() +
ylab("Means of Stat") +
xlab("Legendary Pokemons Type 1")

Distribution of Type is not enough. We should consider the average power of legendary pokemons. From this graph, we see that dragon pokemons are in the powerful pokemons. We should get the pokemon who has power Psychic and Fire. They are in the less powerful group and also there are more pokemons from those types!