Histograma e Gráfico de Barras

Banco de dados - df_pokemon.RData

Carregamento de Dados

load("C:/Users/Hearthz Gaming/Desktop/Base_de_dados-master/df_pokemon.RData")

Análise de Dados

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 ...
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

Tabela de Dados

velocidadepk <- table(df$speed)
velocidadepk
## 
##   5  10  15  20  22  23  24  25  28  29  30  31  32  33  34  35  36  38  39  40 
##   2   3   9  13   1   4   1  10   4   3  32   2   4   2   1  22   3   3   1  32 
##  41  42  43  44  45  46  47  48  49  50  51  52  55  56  57  58  59  60  61  62 
##   2   6   5   3  28   2   2   6   1  42   3   4  29   4   4   8   2  43   2   1 
##  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82 
##   2   5  36   4   4   6   1  34   5   4   2   3  13   3   2   3   1  30   3   1 
##  83  84  85  87  88  89  90  91  92  93  95  97  98  99 100 101 102 103 104 105 
##   3   3  27   1   1   1  27   4   2   2  25   5   3   3  24   6   2   1   2  10 
## 106 108 109 110 111 112 113 114 115 116 118 120 122 123 125 126 130 140 145 150 
##   2   6   2  10   2   2   1   1   8   2   1   4   1   1   3   1   4   1   1   1 
## 160 
##   1

Histograma

hist(df$speed,col = "#8bf3fc",main = "Histograma - Velocidade dos Pokemons",
     xlab = "Velocidade", ylab="Frequência",
     labels = TRUE,
     density = 60,
     las = 1,
     border = "royalblue",
     xlim =c (0,200),
     ylim = c(0,250))

Análise de Dados Qualitativos

Variavel egg group
egg1 <- table(df$egg_group_1)
egg1
## 
##           bug         ditto        dragon         fairy        flying 
##            66             1             9            32            46 
##        ground    humanshape indeterminate       mineral       monster 
##           167            37            41            46            75 
##       no-eggs         plant        water1        water2        water3 
##            70            25            74            15            14
prop.table(egg1)
## 
##           bug         ditto        dragon         fairy        flying 
##   0.091922006   0.001392758   0.012534819   0.044568245   0.064066852 
##        ground    humanshape indeterminate       mineral       monster 
##   0.232590529   0.051532033   0.057103064   0.064066852   0.104456825 
##       no-eggs         plant        water1        water2        water3 
##   0.097493036   0.034818942   0.103064067   0.020891365   0.019498607

Gráfico de Barras

color <- colorRampPalette(c("red","yellow", "green","blue","purple","pink"))
color(15)
##  [1] "#FF0000" "#FF5B00" "#FFB600" "#ECFF00" "#91FF00" "#36FF00" "#00DA24"
##  [8] "#007F7F" "#0024DA" "#2206FB" "#5B12F6" "#941DF1" "#BB4DE5" "#DD86D8"
## [15] "#FFC0CB"
par(cex=0.7)
a <- barplot(egg1,col=color(15),main = "Egg Group 1",
        las = 2,
        space = c(0.4),
        ylim = c(0,200))
text(a,egg1 + 6,labels = egg1)

Conclusão

Pode-se ver na base de dados “df_pokemon.RData”, na variável quantitativa - speed que a velocidade minima é maior que zero e maxima passa um pouco de 150, tendo só três pokemons na faixa de 140 a 200, também é visto como os dados se concentram em torno de 50 a 100. O histograma tem uma concentração no lado esquerdo, assim sendo um histograma assimetrico a direita.

Já na variável qualitativa egg group vemos que os pokemons do grupo ground são em maior número, sendo então os pokemons desse grupo os que mais tem chance de se reproduzir,sendo seguidos pelo grupo de monsters e water1, e os que tem menos chance são os do grupo no-eggs, os dragon e os de water 2 e 3. Não foi incluido Ditto - 1 nos com menos chance pois ele consegue se reproduzir com qualquer pokemon.