Carregamento da base de dados chamada “df_pokemon.RData”. Apresentação de tabela, inspeção e tratamento de dados, tabela de variável quantitativa e histograma.
Carregamento da base de dados
load("C:/Users/thiag/Documents/Base_de_dados-master (1)/Base_de_dados-master/df_pokemon.RData")
Inspeção dos 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 ...
Análise das tabelas apresentadas. Inicialmente, tabelas de variável qualitativa
tabela_ataque <- table(df$attack)
tabela_ataque
##
## 5 10 15 20 22 23 24 25 27 29 30 33 35 36 38 40 41 42 43 44
## 2 3 1 8 1 1 1 7 1 1 19 1 13 1 3 21 2 1 1 1
## 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
## 27 1 3 8 3 36 2 7 5 1 30 3 2 4 3 32 2 4 6 5
## 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85
## 33 4 2 3 3 30 1 6 5 1 30 4 4 4 36 3 6 4 5 30
## 86 87 88 89 90 91 92 93 94 95 97 98 100 102 103 104 105 106 107 108
## 2 2 1 3 29 1 7 2 2 23 1 3 34 1 1 2 15 1 1 1
## 109 110 112 115 117 120 121 123 124 125 129 130 131 134 135 140 147 150 160 165
## 2 14 2 9 3 17 1 3 2 12 1 12 2 2 5 4 1 4 2 1
tabela_defesa <- table(df$defense)
tabela_defesa
##
## 5 10 15 20 23 25 28 30 32 33 34 35 37 38 39 40 41 42 43 44
## 2 1 4 3 1 2 1 14 2 1 3 23 3 2 2 35 2 3 6 4
## 45 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
## 32 2 11 2 48 1 5 5 1 32 1 4 6 1 43 1 7 7 4 34
## 66 67 68 69 70 71 72 73 75 76 77 78 79 80 82 83 84 85 86 87
## 3 7 3 2 48 2 6 2 23 3 6 5 4 33 1 3 2 27 4 1
## 88 89 90 91 95 97 99 100 102 103 105 106 108 110 112 115 116 118 119 120
## 3 1 28 2 24 1 1 26 1 1 11 1 1 8 1 9 1 2 1 9
## 121 122 125 129 130 131 133 135 140 145 150 160 168 180 184 200 230
## 1 2 4 1 9 1 1 2 5 2 4 1 1 2 1 2 1
prop.table(tabela_ataque)
##
## 5 10 15 20 22 23
## 0.002785515 0.004178273 0.001392758 0.011142061 0.001392758 0.001392758
## 24 25 27 29 30 33
## 0.001392758 0.009749304 0.001392758 0.001392758 0.026462396 0.001392758
## 35 36 38 40 41 42
## 0.018105850 0.001392758 0.004178273 0.029247911 0.002785515 0.001392758
## 43 44 45 46 47 48
## 0.001392758 0.001392758 0.037604457 0.001392758 0.004178273 0.011142061
## 49 50 51 52 53 54
## 0.004178273 0.050139276 0.002785515 0.009749304 0.006963788 0.001392758
## 55 56 57 58 59 60
## 0.041782730 0.004178273 0.002785515 0.005571031 0.004178273 0.044568245
## 61 62 63 64 65 66
## 0.002785515 0.005571031 0.008356546 0.006963788 0.045961003 0.005571031
## 67 68 69 70 71 72
## 0.002785515 0.004178273 0.004178273 0.041782730 0.001392758 0.008356546
## 73 74 75 76 77 78
## 0.006963788 0.001392758 0.041782730 0.005571031 0.005571031 0.005571031
## 80 81 82 83 84 85
## 0.050139276 0.004178273 0.008356546 0.005571031 0.006963788 0.041782730
## 86 87 88 89 90 91
## 0.002785515 0.002785515 0.001392758 0.004178273 0.040389972 0.001392758
## 92 93 94 95 97 98
## 0.009749304 0.002785515 0.002785515 0.032033426 0.001392758 0.004178273
## 100 102 103 104 105 106
## 0.047353760 0.001392758 0.001392758 0.002785515 0.020891365 0.001392758
## 107 108 109 110 112 115
## 0.001392758 0.001392758 0.002785515 0.019498607 0.002785515 0.012534819
## 117 120 121 123 124 125
## 0.004178273 0.023676880 0.001392758 0.004178273 0.002785515 0.016713092
## 129 130 131 134 135 140
## 0.001392758 0.016713092 0.002785515 0.002785515 0.006963788 0.005571031
## 147 150 160 165
## 0.001392758 0.005571031 0.002785515 0.001392758
prop.table(tabela_defesa)
##
## 5 10 15 20 23 25
## 0.002785515 0.001392758 0.005571031 0.004178273 0.001392758 0.002785515
## 28 30 32 33 34 35
## 0.001392758 0.019498607 0.002785515 0.001392758 0.004178273 0.032033426
## 37 38 39 40 41 42
## 0.004178273 0.002785515 0.002785515 0.048746518 0.002785515 0.004178273
## 43 44 45 47 48 49
## 0.008356546 0.005571031 0.044568245 0.002785515 0.015320334 0.002785515
## 50 51 52 53 54 55
## 0.066852368 0.001392758 0.006963788 0.006963788 0.001392758 0.044568245
## 56 57 58 59 60 61
## 0.001392758 0.005571031 0.008356546 0.001392758 0.059888579 0.001392758
## 62 63 64 65 66 67
## 0.009749304 0.009749304 0.005571031 0.047353760 0.004178273 0.009749304
## 68 69 70 71 72 73
## 0.004178273 0.002785515 0.066852368 0.002785515 0.008356546 0.002785515
## 75 76 77 78 79 80
## 0.032033426 0.004178273 0.008356546 0.006963788 0.005571031 0.045961003
## 82 83 84 85 86 87
## 0.001392758 0.004178273 0.002785515 0.037604457 0.005571031 0.001392758
## 88 89 90 91 95 97
## 0.004178273 0.001392758 0.038997214 0.002785515 0.033426184 0.001392758
## 99 100 102 103 105 106
## 0.001392758 0.036211699 0.001392758 0.001392758 0.015320334 0.001392758
## 108 110 112 115 116 118
## 0.001392758 0.011142061 0.001392758 0.012534819 0.001392758 0.002785515
## 119 120 121 122 125 129
## 0.001392758 0.012534819 0.001392758 0.002785515 0.005571031 0.001392758
## 130 131 133 135 140 145
## 0.012534819 0.001392758 0.001392758 0.002785515 0.006963788 0.002785515
## 150 160 168 180 184 200
## 0.005571031 0.001392758 0.001392758 0.002785515 0.001392758 0.002785515
## 230
## 0.001392758
barplot(tabela_ataque)
barplot(tabela_defesa)
Summary da base de dados utilizada
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
Análise da variável quantitativa. Apresentação do histograma
hist(df$attack, col = "orange", main = "Histograma pokemon X ataque", xlab = "ataque", ylab="pokemons")
hist(df$defense, col = "purple", main = "Histograma pokemon X defesa", xlab = "defesa" , ylab = "pokemons")
hist(df$defense,col="purple", border = "black",main="Histograma",
xlab = "defesa", , labels = TRUE,ylab="pokemons")
Obs: Nota-se que o Histograma pokemon X ataque é assimétrico a direita, assim como o Histograma pokemon X defesa também é assimétrico a direita.