load("C:/Users/Myllena/Desktop/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"
sd(df$attack)## [1] 28.93704
var(df$attack)## [1] 837.3524
mean(df$attack)## [1] 74.85376
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)
library(reactable)
#Attack (quantitativa) por type_1(qualitativa)
df %>% select(attack,type_1) %>%
group_by(type_1) %>%
summarise(Média=round(mean(attack),2),
Desvio_Padrao=round(sd(attack),2),
Mediana=median(attack)) %>% flextable()%>%
theme_zebra()type_1 | Média | Desvio_Padrao | Mediana |
bug | 65.22 | 30.74 | 63.0 |
dark | 86.25 | 24.34 | 86.5 |
dragon | 102.62 | 29.64 | 97.5 |
electric | 67.78 | 25.15 | 61.5 |
fairy | 61.53 | 29.75 | 52.0 |
fighting | 94.72 | 27.66 | 100.0 |
fire | 81.61 | 25.30 | 82.5 |
flying | 71.67 | 42.52 | 70.0 |
ghost | 66.65 | 25.29 | 65.0 |
grass | 70.91 | 24.08 | 68.0 |
ground | 91.30 | 28.62 | 83.5 |
ice | 70.70 | 25.94 | 65.0 |
normal | 71.73 | 29.30 | 70.0 |
poison | 74.68 | 19.63 | 74.0 |
psychic | 60.22 | 30.77 | 52.5 |
rock | 88.17 | 32.58 | 86.5 |
steel | 83.55 | 24.61 | 82.5 |
water | 71.05 | 25.03 | 70.0 |
df %>% select(attack,type_1) %>%
group_by(type_1) %>%
summarise(minimo=min(attack),
primeiro_quartil=quantile(attack,probs=0.25),
mediana=median(attack),
terceiro_quartil=quantile(attack,probs=0.75),
maximo=max(attack)) %>%
flextable() %>% theme_zebra() type_1 | minimo | primeiro_quartil | mediana | terceiro_quartil | maximo |
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 |
boxplot(attack~type_1, data=df,
col=c("pink","purple"),
main="Gráfico 1 - Boxplot do ataque por tipo de pokemón")