load("C:/Users/renata/Desktop/df_pokemon.RData")
summary(df$attack)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 5.00 53.00 73.00 74.85 95.00 165.00
summary(df$type_1)
## Length Class Mode
## 718 character character
var(df$attack)
## [1] 837.3524
sd(df$attack)
## [1] 28.93704
mean(df$attack)
## [1] 74.85376
Cruzamento de variáveis quantitativas por variáveis qualitativas
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)
df %>% select(attack,type_1) %>%
group_by(type_1) %>%
summarise(Média=round(mean(attack),2),
Desvio_Padrao=round(sd(attack),2)) %>% flextable() %>% theme_tron()
type_1 | Média | Desvio_Padrao |
bug | 65.22 | 30.74 |
dark | 86.25 | 24.34 |
dragon | 102.62 | 29.64 |
electric | 67.78 | 25.15 |
fairy | 61.53 | 29.75 |
fighting | 94.72 | 27.66 |
fire | 81.61 | 25.30 |
flying | 71.67 | 42.52 |
ghost | 66.65 | 25.29 |
grass | 70.91 | 24.08 |
ground | 91.30 | 28.62 |
ice | 70.70 | 25.94 |
normal | 71.73 | 29.30 |
poison | 74.68 | 19.63 |
psychic | 60.22 | 30.77 |
rock | 88.17 | 32.58 |
steel | 83.55 | 24.61 |
water | 71.05 | 25.03 |
#Gerar uma visualização dessa tabela (min, 1 quartil, mediana,3 quartil e maximo)
df %>% select(attack,type_1) %>%
group_by(type_1) %>%
summarise(Média=round(mean(attack),2),primeiro_quartil=quantile(attack,probs=0.25),
mediana=median(attack),
terceiro_quartil=quantile(attack,probs=0.75),
Desvio_Padrao=round(sd(attack),2)) %>% flextable() %>% theme_tron()
type_1 | Média | primeiro_quartil | mediana | terceiro_quartil | Desvio_Padrao |
bug | 65.22 | 42.50 | 63.0 | 90.00 | 30.74 |
dark | 86.25 | 65.00 | 86.5 | 97.50 | 24.34 |
dragon | 102.62 | 78.75 | 97.5 | 130.00 | 29.64 |
electric | 67.78 | 50.00 | 61.5 | 85.00 | 25.15 |
fairy | 61.53 | 45.00 | 52.0 | 72.00 | 29.75 |
fighting | 94.72 | 80.00 | 100.0 | 120.00 | 27.66 |
fire | 81.61 | 60.75 | 82.5 | 97.75 | 25.30 |
flying | 71.67 | 50.00 | 70.0 | 92.50 | 42.52 |
ghost | 66.65 | 50.00 | 65.0 | 85.00 | 25.29 |
grass | 70.91 | 53.50 | 68.0 | 89.75 | 24.08 |
ground | 91.30 | 72.00 | 83.5 | 115.75 | 28.62 |
ice | 70.70 | 50.00 | 65.0 | 82.50 | 25.94 |
normal | 71.73 | 55.00 | 70.0 | 85.00 | 29.30 |
poison | 74.68 | 60.00 | 74.0 | 90.50 | 19.63 |
psychic | 60.22 | 36.25 | 52.5 | 74.50 | 30.77 |
rock | 88.17 | 58.00 | 86.5 | 112.75 | 32.58 |
steel | 83.55 | 75.00 | 82.5 | 97.50 | 24.61 |
water | 71.05 | 52.00 | 70.0 | 90.00 | 25.03 |
boxplot(attack~type_1, data=df ,
col=c("red","royalblue"),
horizontal =F,
main="Gráfico 1 ")
Todos apresentam desvio padrão parecidos, próximos a 30, apenas se destoando dois deles: voadores com 45 e de poção com 19. A média mais alta é a dos dragões concentrando acima de 50, tendo uma distribuição parecida, porém com valores altos.