R Markdown

Introdução da Análise

Vamos análisar hoje, os tipos de pokemons em relação ao seu potêncial de defesa.

BASE DE DADOS

load("C:/Users/18899108722/Desktop/Base_de_dados-master/df_pokemon.RData")
head(df)
##   id    pokemon species_id height weight base_experience type_1 type_2 attack
## 1  1  bulbasaur          1      7     69              64  grass poison     49
## 2  2    ivysaur          2     10    130             142  grass poison     62
## 3  3   venusaur          3     20   1000             236  grass poison     82
## 4  4 charmander          4      6     85              62   fire   <NA>     52
## 5  5 charmeleon          5     11    190             142   fire   <NA>     64
## 6  6  charizard          6     17    905             240   fire flying     84
##   defense hp special_attack special_defense speed color_1 color_2 color_f
## 1      49 45             65              65    45 #78C850 #A040A0 #81A763
## 2      63 60             80              80    60 #78C850 #A040A0 #81A763
## 3      83 80            100             100    80 #78C850 #A040A0 #81A763
## 4      43 39             60              50    65 #F08030    <NA> #F08030
## 5      58 58             80              65    80 #F08030    <NA> #F08030
## 6      78 78            109              85   100 #F08030 #A890F0 #DE835E
##   egg_group_1 egg_group_2 url_image         x        y
## 1     monster       plant     1.png  32.82239 17.21614
## 2     monster       plant     2.png  33.32643 16.71226
## 3     monster       plant     3.png  33.93778 16.17232
## 4     monster      dragon     4.png -24.36338 30.78973
## 5     monster      dragon     5.png -24.57820 30.60161
## 6     monster      dragon     6.png -25.50657 29.77037
summary(df)
##        id          pokemon            species_id        height      
##  Min.   :  1.0   Length:718         Min.   :  1.0   Min.   :  1.00  
##  1st Qu.:180.2   Class :character   1st Qu.:180.2   1st Qu.:  6.00  
##  Median :359.5   Mode  :character   Median :359.5   Median : 10.00  
##  Mean   :359.5                      Mean   :359.5   Mean   : 11.41  
##  3rd Qu.:538.8                      3rd Qu.:538.8   3rd Qu.: 14.00  
##  Max.   :718.0                      Max.   :718.0   Max.   :145.00  
##      weight       base_experience     type_1             type_2         
##  Min.   :   1.0   Min.   : 36.00   Length:718         Length:718        
##  1st Qu.:  95.0   1st Qu.: 65.25   Class :character   Class :character  
##  Median : 280.0   Median :147.00   Mode  :character   Mode  :character  
##  Mean   : 568.2   Mean   :141.55                                        
##  3rd Qu.: 609.5   3rd Qu.:177.00                                        
##  Max.   :9500.0   Max.   :608.00                                        
##      attack          defense             hp         special_attack  
##  Min.   :  5.00   Min.   :  5.00   Min.   :  1.00   Min.   : 10.00  
##  1st Qu.: 53.00   1st Qu.: 50.00   1st Qu.: 50.00   1st Qu.: 45.00  
##  Median : 73.00   Median : 65.00   Median : 65.00   Median : 65.00  
##  Mean   : 74.85   Mean   : 70.67   Mean   : 68.37   Mean   : 68.47  
##  3rd Qu.: 95.00   3rd Qu.: 85.00   3rd Qu.: 80.00   3rd Qu.: 90.00  
##  Max.   :165.00   Max.   :230.00   Max.   :255.00   Max.   :154.00  
##  special_defense      speed          color_1            color_2         
##  Min.   : 20.00   Min.   :  5.00   Length:718         Length:718        
##  1st Qu.: 50.00   1st Qu.: 45.00   Class :character   Class :character  
##  Median : 65.00   Median : 65.00   Mode  :character   Mode  :character  
##  Mean   : 69.09   Mean   : 65.72                                        
##  3rd Qu.: 85.00   3rd Qu.: 85.00                                        
##  Max.   :230.00   Max.   :160.00                                        
##    color_f          egg_group_1        egg_group_2         url_image        
##  Length:718         Length:718         Length:718         Length:718        
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##        x                 y          
##  Min.   :-49.152   Min.   :-45.793  
##  1st Qu.:-17.695   1st Qu.:-17.293  
##  Median :  0.705   Median : -0.628  
##  Mean   :  0.000   Mean   :  0.000  
##  3rd Qu.: 15.905   3rd Qu.: 18.155  
##  Max.   : 53.142   Max.   : 46.593
str(df)
## Classes 'tbl_df', 'tbl' and 'data.frame':    718 obs. of  22 variables:
##  $ id             : num  1 2 3 4 5 6 7 8 9 10 ...
##  $ pokemon        : chr  "bulbasaur" "ivysaur" "venusaur" "charmander" ...
##  $ species_id     : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ height         : int  7 10 20 6 11 17 5 10 16 3 ...
##  $ weight         : int  69 130 1000 85 190 905 90 225 855 29 ...
##  $ base_experience: int  64 142 236 62 142 240 63 142 239 39 ...
##  $ type_1         : chr  "grass" "grass" "grass" "fire" ...
##  $ type_2         : chr  "poison" "poison" "poison" NA ...
##  $ attack         : int  49 62 82 52 64 84 48 63 83 30 ...
##  $ defense        : int  49 63 83 43 58 78 65 80 100 35 ...
##  $ hp             : int  45 60 80 39 58 78 44 59 79 45 ...
##  $ special_attack : int  65 80 100 60 80 109 50 65 85 20 ...
##  $ special_defense: int  65 80 100 50 65 85 64 80 105 20 ...
##  $ speed          : int  45 60 80 65 80 100 43 58 78 45 ...
##  $ color_1        : chr  "#78C850" "#78C850" "#78C850" "#F08030" ...
##  $ color_2        : chr  "#A040A0" "#A040A0" "#A040A0" NA ...
##  $ color_f        : chr  "#81A763" "#81A763" "#81A763" "#F08030" ...
##  $ egg_group_1    : chr  "monster" "monster" "monster" "monster" ...
##  $ egg_group_2    : chr  "plant" "plant" "plant" "dragon" ...
##  $ url_image      : chr  "1.png" "2.png" "3.png" "4.png" ...
##  $ x              : num  32.8 33.3 33.9 -24.4 -24.6 ...
##  $ y              : num  17.2 16.7 16.2 30.8 30.6 ...
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(flextable)
## Warning: package 'flextable' was built under R version 4.2.3

Análise Gráfica

Gráfico composto por média e desvio padrão dos tipos de pokemon em relação a sua defesa.

df %>% select(type_2,defense) %>% group_by(type_2) %>% summarise (média=mean(defense),desvio_padrao=sd(defense))%>% flextable() %>% theme_zebra()

type_2

média

desvio_padrao

bug

80.00000

26.45751

dark

65.75000

27.85797

dragon

84.00000

26.68333

electric

68.33333

29.48672

fairy

59.58824

32.77968

fighting

77.94737

23.79186

fire

67.22222

24.25272

flying

65.41379

23.87932

ghost

83.36364

36.51650

grass

73.33333

21.89816

ground

83.36667

35.57167

ice

79.70000

37.76845

normal

53.75000

16.17354

poison

57.48387

17.91251

psychic

78.96296

24.31284

rock

126.85714

38.82873

steel

104.15789

28.09757

water

80.33333

28.19843

66.55526

26.81083

Conclusão

1- Os pokemons que se caracterizam como “pedras” (Rock), apresenta maiores potênciais de defesa. 2 -Os pokemons que se caracterizam como “Normais (normal)”, apresentam pouca variância em potêncial de defesa 3- A uma grande diversidade de pokemons diferentes, e seus potênciais de defesa variam muito, entretanto não há pokemons que variam abaixo de 50k de potêncial de defesa.