Esse é o meu relatório de Estatística de 27 de Outubro de 2022.
Esse é o meu segundo texto no R.
Essa é uma outra frase no R.
# Passo 1 - carregar o banco de dados
load("~/Base_de_dados-master/Titanic.RData")
tabela_sexo=table(Titanic$Sexo,Titanic$Sobreviveu)
tabela_sexo
##
## Não sobreviveu Sobreviveu
## Feminino 126 344
## Masculino 1364 366
Tem mais homens que mulheres no Titanic
##TABELA DE PROPORÇÃO
tabela_idade=table(Titanic$Idade,Titanic$Sobreviveu)
tabela_idade
##
## Não sobreviveu Sobreviveu
## criança 52 57
## adulto 1438 653
prop.table(tabela_sexo,1)
##
## Não sobreviveu Sobreviveu
## Feminino 0.2680851 0.7319149
## Masculino 0.7884393 0.2115607
#TABELA DO DARK VADER
vou colocar aqui a tabela de starwars!
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(flextable)
tabyl(Titanic$Sexo)
## Titanic$Sexo n percent
## Feminino 470 0.2136364
## Masculino 1730 0.7863636
Titanic %>% tabyl(Classe,Sobreviveu) %>%
adorn_percentages("row") %>% adorn_pct_formatting(digits=2) %>%
flextable() %>% theme_vader()
Classe | Não sobreviveu | Sobreviveu |
Tripula<e7><e3>o | 76.05% | 23.95% |
Primeira | 37.65% | 62.35% |
Segunda | 58.60% | 41.40% |
Terceira | 74.79% | 25.21% |
#meu gráfico no R
library(RColorBrewer)
COR=brewer.pal(4,"Spectral")
COR
## [1] "#D7191C" "#FDAE61" "#ABDDA4" "#2B83BA"
Titanic$Classe=gsub("Tripula\xe7\xe3o","Tripulacao",Titanic$Classe)
tabela_classe=table(Titanic$Classe,Titanic$Sobreviveu)
tabela_classe
##
## Não sobreviveu Sobreviveu
## Primeira 122 202
## Segunda 167 118
## Terceira 528 178
## Tripulacao 673 212
barplot(tabela_classe,beside=TRUE,col=COR)
#conclusão