load("C:/Users/gabri/Desktop/Base_de_dados-master/df_pokemon.RData")
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(hp,type_1) %>%
group_by(type_1) %>% summarise(Média=round(mean(hp),2),
Desvio_Padrao=round(sd(hp),2)) %>% flextable() %>% theme_tron()
type_1 | Média | Desvio_Padrao |
bug | 55.95 | 16.67 |
dark | 67.18 | 21.92 |
dragon | 78.04 | 22.94 |
electric | 59.50 | 17.74 |
fairy | 74.12 | 23.59 |
fighting | 70.24 | 26.83 |
fire | 68.35 | 19.73 |
flying | 68.00 | 24.43 |
ghost | 61.57 | 31.92 |
grass | 66.20 | 19.39 |
ground | 72.40 | 25.89 |
ice | 71.65 | 21.70 |
normal | 76.53 | 36.88 |
poison | 67.25 | 19.67 |
psychic | 70.41 | 30.19 |
rock | 64.90 | 20.74 |
steel | 64.82 | 17.03 |
water | 70.87 | 27.85 |
df %>% select(hp,type_1) %>%
group_by(type_1) %>%
summarise(minimo=min(hp),
primeiro_quartil=quantile(hp,probs=0.25),
mediana=median(hp),
terceiro_quartil=quantile(hp,probs=0.75),
maximo=max(hp)) %>%
flextable() %>% theme_tron()
type_1 | minimo | primeiro_quartil | mediana | terceiro_quartil | maximo |
bug | 1 | 45.00 | 60.0 | 70.00 | 86 |
dark | 35 | 51.50 | 65.0 | 72.75 | 126 |
dragon | 41 | 64.00 | 76.5 | 96.25 | 125 |
electric | 20 | 45.00 | 60.0 | 70.00 | 90 |
fairy | 35 | 55.00 | 78.0 | 90.00 | 126 |
fighting | 30 | 50.00 | 70.0 | 80.00 | 144 |
fire | 38 | 55.75 | 65.0 | 78.00 | 115 |
flying | 40 | 59.50 | 79.0 | 82.00 | 85 |
ghost | 20 | 44.50 | 58.0 | 62.00 | 150 |
grass | 30 | 50.00 | 65.0 | 75.00 | 123 |
ground | 10 | 52.25 | 71.5 | 90.00 | 115 |
ice | 36 | 53.00 | 70.0 | 90.00 | 110 |
normal | 30 | 55.00 | 70.0 | 85.00 | 255 |
poison | 35 | 50.00 | 67.5 | 80.25 | 105 |
psychic | 20 | 51.25 | 66.0 | 80.00 | 190 |
rock | 30 | 50.00 | 68.5 | 77.75 | 123 |
steel | 40 | 57.00 | 60.0 | 73.75 | 100 |
water | 20 | 50.00 | 69.0 | 90.00 | 170 |
boxplot(hp~type_1, data = df,col=c("orange","grey"),
las = 2,
main= "Boxplot - hp do pokemon por tipo 1 dos pokemon")
Nessa atividade foi usada a base de dados df pokemon, na qual dentro dela há diversas variáveis qualitativas e quantitativas. As duas variáveis escolhidas para se cruzarem nos gráficos a seguir foram, hp e type_1.
Cruzando os dados da variável tipo 1 e hp, vemos na tabela as médias de hp de cada um dos 18 tipos de pokemon, sendo a maior delas a média dos pokemon tipo dragão. Além disso, percebemos que o menor desvio padrão, ou seja, menor taxa de variação do hp em referência a média do seu tipo, é a dos pokemon bug.
Por último, avaliando o gráfico boxplot, percebemos que há 2 outliers de hp do tipo normal, sendo um o maior hp de todos os pokemon e há 1 outlier do tipo psychic.