load("C:/Users/DELL/Downloads/Base_de_dados-master/df_pokemon.RData")
names(df)
## [1] "id" "pokemon" "species_id" "height"
## [5] "weight" "base_experience" "type_1" "type_2"
## [9] "attack" "defense" "hp" "special_attack"
## [13] "special_defense" "speed" "color_1" "color_2"
## [17] "color_f" "egg_group_1" "egg_group_2" "url_image"
## [21] "x" "y"
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
library(dplyr)
##
## 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)
df %>% select(attack,type_1) %>%
group_by("Tipo 1" = type_1) %>%
summarise(Média=round(mean(attack),2),
Variância=round(var(attack),2),
"Desvio Padrão"=round(sd(attack),2)) %>%
flextable() %>% theme_tron()
Tipo 1 | Média | Variância | Desvio Padrão |
bug | 65.22 | 945.05 | 30.74 |
dark | 86.25 | 592.27 | 24.34 |
dragon | 102.62 | 878.68 | 29.64 |
electric | 67.78 | 632.63 | 25.15 |
fairy | 61.53 | 885.14 | 29.75 |
fighting | 94.72 | 765.29 | 27.66 |
fire | 81.61 | 639.98 | 25.30 |
flying | 71.67 | 1,808.33 | 42.52 |
ghost | 66.65 | 639.42 | 25.29 |
grass | 70.91 | 579.75 | 24.08 |
ground | 91.30 | 819.39 | 28.62 |
ice | 70.70 | 672.68 | 25.94 |
normal | 71.73 | 858.55 | 29.30 |
poison | 74.68 | 385.34 | 19.63 |
psychic | 60.22 | 946.75 | 30.77 |
rock | 88.17 | 1,061.17 | 32.58 |
steel | 83.55 | 605.50 | 24.61 |
water | 71.05 | 626.51 | 25.03 |
df %>% select(attack,type_1) %>%
group_by("Tipo 1" = type_1) %>%
summarise(Mínimo=min(attack),
"Primeiro Quartil"=quantile(attack,probs=0.25),
Mediana=round(median(attack),2),
"Terceiro Quartil"=quantile(attack,probs=0.75),
Máximo=max(attack)) %>%
flextable() %>% theme_tron()
Tipo 1 | Mínimo | Primeiro Quartil | Mediana | Terceiro Quartil | Máximo |
bug | 10 | 42.50 | 63.0 | 90.00 | 135 |
dark | 50 | 65.00 | 86.5 | 97.50 | 131 |
dragon | 50 | 78.75 | 97.5 | 130.00 | 150 |
electric | 30 | 50.00 | 61.5 | 85.00 | 123 |
fairy | 20 | 45.00 | 52.0 | 72.00 | 131 |
fighting | 35 | 80.00 | 100.0 | 120.00 | 140 |
fire | 40 | 60.75 | 82.5 | 97.75 | 140 |
flying | 30 | 50.00 | 70.0 | 92.50 | 115 |
ghost | 30 | 50.00 | 65.0 | 85.00 | 115 |
grass | 27 | 53.50 | 68.0 | 89.75 | 130 |
ground | 40 | 72.00 | 83.5 | 115.75 | 150 |
ice | 30 | 50.00 | 65.0 | 82.50 | 130 |
normal | 5 | 55.00 | 70.0 | 85.00 | 160 |
poison | 43 | 60.00 | 74.0 | 90.50 | 106 |
psychic | 20 | 36.25 | 52.5 | 74.50 | 150 |
rock | 40 | 58.00 | 86.5 | 112.75 | 165 |
steel | 24 | 75.00 | 82.5 | 97.50 | 135 |
water | 10 | 52.00 | 70.0 | 90.00 | 130 |
par(cex=0.5)
boxplot(attack~type_1, data = df,
col=c("red","royalblue"),
main= " Gráfico 1 - Boxplot do Ataque por Tipo de Pokemon",
ylab = "Ataque do Pokemon",
xlab = "Tipo de Pokemon")
Através das informações obtidas da tabela 1, é possível perceber que em relação a média, a maior parte dos pokemons possui um ataque entre sessenta e noventa. O tipo de pokemon que apresenta menor variância de ataque é o “poison”, enquanto aquele que apresenta maior variância é o “flying”. Do mesmo modo, pode-se afirmar que em relação ao desvio padrão, o pokemon do tipo “poison” segue tendo o menor desvio padrão, enquanto o “flying”, possui o maior.
Ademais, em relação ao boxplot, o eixo x é aquele que representa o “Tipo de Pokemon”, já o eixo y é representado pelo seu “Ataque”. Não há extrema presença de outliers, sendo encontrados apenas seis — em diferentes pokemons, exceto o tipo “fairy”, com dois outliers — fazendo com que seja válido ressaltar que os resultados não fogem muito da normalidade.
Outrossim, a proporção de caixas simétricas e assimétricas são semelhantes, enquanto o tamanho das caixas é bastante divergente, bem como as diferenças entre o mínimo e o máximo, de modo que se possa concluir que existem certos tipos de pokemon cuja variabilidade de ataque é muito grande, enquanto outros a dissemelhança tende a ser mais reduzida.