Carregando a base de dados “pokemon”

load("C:/Users/Marcos/Desktop/Base_de_dados-master/df_pokemon.RData")

Carregando pacotes adicionais

library(readxl)
library(flextable)
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(ggplot2)

Mostrando tabela da base de dados

head(df) %>% flextable()  %>% theme_alafoli()

id

pokemon

species_id

height

weight

base_experience

type_1

type_2

attack

defense

hp

special_attack

special_defense

speed

color_1

color_2

color_f

egg_group_1

egg_group_2

url_image

x

y

1

bulbasaur

1

7

69

64

grass

poison

49

49

45

65

65

45

#78C850

#A040A0

#81A763

monster

plant

1.png

32.82239

17.21614

2

ivysaur

2

10

130

142

grass

poison

62

63

60

80

80

60

#78C850

#A040A0

#81A763

monster

plant

2.png

33.32643

16.71226

3

venusaur

3

20

1,000

236

grass

poison

82

83

80

100

100

80

#78C850

#A040A0

#81A763

monster

plant

3.png

33.93778

16.17232

4

charmander

4

6

85

62

fire

52

43

39

60

50

65

#F08030

#F08030

monster

dragon

4.png

-24.36338

30.78973

5

charmeleon

5

11

190

142

fire

64

58

58

80

65

80

#F08030

#F08030

monster

dragon

5.png

-24.57820

30.60161

6

charizard

6

17

905

240

fire

flying

84

78

78

109

85

100

#F08030

#A890F0

#DE835E

monster

dragon

6.png

-25.50657

29.77037

Média e desvio padrão

df %>% select(type_1,attack) %>% 
  group_by(type_1) %>% 
  summarise(média=mean(attack),
            desvio_padrao=sd(attack)) %>% 
  flextable()

type_1

média

desvio_padrao

bug

65.22222

30.74161

dark

86.25000

24.33657

dragon

102.62500

29.64253

electric

67.77778

25.15223

fairy

61.52941

29.75130

fighting

94.72000

27.66394

fire

81.60870

25.29776

flying

71.66667

42.52450

ghost

66.65217

25.28674

grass

70.90909

24.07790

ground

91.30000

28.62498

ice

70.69565

25.93600

normal

71.73118

29.30096

poison

74.67857

19.63001

psychic

60.21739

30.76933

rock

88.17500

32.57566

steel

83.54545

24.60687

water

71.04762

25.03013

Mediana

df %>% select(type_1,attack) %>% 
  group_by(type_1) %>% 
  summarise(mínimo=min(attack),
            quartil1 = quantile(attack,0.25),
            mediana= median(attack),
            quartil3= quantile(attack,0.75),
            maximo=max(attack)) %>% 
  flextable()

type_1

mínimo

quartil1

mediana

quartil3

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

boxplot(df$attack ~ df$type_1,
        col=c("violet","purple"),
        main="Boxplot: ataque x tipo",
        ylab = "poder de ataque",
        xlab="categoria")

Conclusão

A base de dados usada possui 718 linhas e 22 colunas, sendo elas 11 variáveis quantitativas, 8 qualitativas e 3 adicionais. Para esse relatório, foram escolhidas a variável qualitativa “Tipo” e a variável quantitativa “Ataque”.

A hipótese levantada é: Qual categoria de pokemon possui o maior poder de ataque? Analisando a média, a mediana e o desvio padrão, foi concluído que o tipo dragão possui o maior poder de ataque entre as categorias, enquanto os mais fracos são o fairy e o psychic. A diferença é mínima, porém na média o fairy se sobressai e quanto a mediana, o psychic é melhor no ataque. A categoria com maior número de outliers é a fairy, tendo dois pokemon com um poder de ataque bem maior do que o resto do grupo.