Carregamos a base de dados

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

Dowloads de algumas bibliotecas

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

Analisamos de maneira geral a base de dados

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
head(df)
## # A tibble: 6 × 22
##      id pokemon    species_id height weight base_experience type_1 type_2 attack
##   <dbl> <chr>           <int>  <int>  <int>           <int> <chr>  <chr>   <int>
## 1     1 bulbasaur           1      7     69              64 grass  poison     49
## 2     2 ivysaur             2     10    130             142 grass  poison     62
## 3     3 venusaur            3     20   1000             236 grass  poison     82
## 4     4 charmander          4      6     85              62 fire   <NA>       52
## 5     5 charmeleon          5     11    190             142 fire   <NA>       64
## 6     6 charizard           6     17    905             240 fire   flying     84
## # ℹ 13 more variables: defense <int>, hp <int>, special_attack <int>,
## #   special_defense <int>, speed <int>, color_1 <chr>, color_2 <chr>,
## #   color_f <chr>, egg_group_1 <chr>, egg_group_2 <chr>, url_image <chr>,
## #   x <dbl>, y <dbl>
head(df) %>% flextable() %>% theme_tron()

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

Calculo da Média, mediana e desvio padrão das bases escolhidas (defense e type_2)

df %>% select(type_2,defense) %>%
  group_by(type_2) %>%
  summarise(Média=mean(defense), Mediana=median(defense),
            DP=sd(defense), Mínimo=min(defense),
            Máximo=max(defense)) %>% flextable() %>% theme_tron_legacy()

type_2

Média

Mediana

DP

Mínimo

Máximo

bug

80.00000

90.0

26.45751

50

100

dark

65.75000

63.5

27.85797

20

110

dragon

84.00000

85.0

26.68333

35

120

electric

68.33333

59.0

29.48672

38

120

fairy

59.58824

57.0

32.77968

15

150

fighting

77.94737

71.0

23.79186

40

129

fire

67.22222

60.0

24.25272

30

100

flying

65.41379

62.0

23.87932

30

140

ghost

83.36364

75.0

36.51650

45

150

grass

73.33333

73.0

21.89816

30

122

ground

83.36667

77.0

35.57167

40

200

ice

79.70000

73.5

37.76845

50

180

normal

53.75000

55.0

16.17354

33

72

poison

57.48387

59.0

17.91251

30

99

psychic

78.96296

80.0

24.31284

15

130

rock

126.85714

122.5

38.82873

85

230

steel

104.15789

100.0

28.09757

60

168

water

80.33333

80.0

28.19843

32

125

66.55526

62.0

26.81083

5

200

Gráfico boxplot das bases

boxplot(df$defense ~ df$type_2, col = c("red","blue","pink","yellow"), xlab = "Tipo", ylab = "defesa", main = "Boxplot da defesa x tipo")

Conclusão

Analisamos de maneira geral os Pokemons, seja sua defesa, velocidade, ataque, hp, entre outros. E nós analisamos através de tabelas e um gráfico boxplot.

Ao analisar a tabela de defesa x tipo, damos a entender que o tipo de pokemon com maior defesa é de 230 e é o tipo de pokemon Rock. Já o tipo de pokemon que apresenta menor defesa com 72 é o normal. Além disso analisamos também os valores das medianas de cada tipo de pokemon, a maior mediana segue sendo o do tipo rock com aproximadamente 122,5 e a menor mediana é o normal com aproximadamente 55.

Tambem analisamos a média de defesa dos pokemons e o desvio padrão, o pokemon do tipo rock é que apresenta a maior dessas duas e o pokemon do tipo normal é o que tem menor. Logo podemos afirmar que, o pokemon que tem a melhor defesa, assim como maior vida é o do tipo Rock, já o tipo de pokemon que apresenta a menor defesa é a do tipo normal.