load("C:/Users/Usuario/Desktop/Base_de_dados-master/CARROS.RData")
load("C:/Users/Usuario/Desktop/Base_de_dados-master/df_pokemon.RData")
Nesse setor vemos o tipo de variável.
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"
class(df$attack)
## [1] "integer"
class(CARROS$Preco)
## [1] "numeric"
class (df$type_1)
## [1] "character"
class (CARROS$Tipodecombustivel)
## [1] "numeric"
Nessa parte, modificaremos o tipo do Pokémon e de combustivel.
df$type_1 <- as.factor(df$type_1)
CARROS$Tipodecombustivel <- as.factor(CARROS$Tipodecombustivel)
Elaboração das primeiras tabelas.
tabela_pokemon <- table(df$type_1)
tabela_carros <- table(CARROS$Tipodecombustivel)
tabela_pokemon
##
## bug dark dragon electric fairy fighting fire flying
## 63 28 24 36 17 25 46 3
## ghost grass ground ice normal poison psychic rock
## 23 66 30 23 93 28 46 40
## steel water
## 22 105
tabela_carros
##
## 0 1
## 18 14
Vamos corrigir criar três gráficos de barra.
barplot(tabela_pokemon, las = 2)
barplot(tabela_pokemon, las = 2, col = "red",
main = "solução 1")
par(cex=0.6)
barplot(tabela_pokemon, col = "blue",
main = "solução 2")
barplot(tabela_carros, col = "yellow")