Dados descritivos da matéria
Análise de dados
Professor Adriano Lauro
Centro Universitário Celso Lisboa
Trabalho feito com base nos dados das eleições de 2024, Rio de
Janeiro
planilha adquirida pelo site do STJ
library(readxl)
library(readr)
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)
library(kableExtra)
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
Carregamento de Planilha
library(readxl)
Planilia_Eleiçao_tabela_R <- read_excel("Planilia Eleiçao tabela R.xlsx")
Carregamento de Pacotes
library(kableExtra)
library(dplyr)
library(knitr)
Estatística Básica
Função Kable
Média
Desvio Padrão
knitr::kable(head(Planilia_Eleiçao_tabela_R, 5))
| *22222 - CARLOS NANTES BOLSONARO |
130480 |
Válido |
Eleito por QP |
| *55005 - MARCIO CESAR GOMES RIBEIRO JUNIOR |
56770 |
Válido |
Eleito por QP |
| *13777 - TAINÁ REIS DE PAULA KAPAZ |
49986 |
Válido |
Eleito por QP |
| *55622 - CARLO FERREIRA DE CAIADO CASTRO |
47671 |
Válido |
Eleito por QP |
| *55123 - RAFAEL ALOISIO FREITAS |
40892 |
Válido |
Eleito por QP |
class(Planilia_Eleiçao_tabela_R$`Votos computados`)
## [1] "character"
Planilia_Eleiçao_tabela_R$`Votos computados` <- as.numeric(as.character(Planilia_Eleiçao_tabela_R$`Votos computados`))
mean(Planilia_Eleiçao_tabela_R$`Votos computados`, na.rm = TRUE)
## [1] 2862.197
sd(Planilia_Eleiçao_tabela_R$`Votos computados`, 5)
## [1] 7275.058
Gráficos
ggplot(Planilia_Eleiçao_tabela_R) + aes(`Votos computados`) + geom_bar(color = "blue", fill = "yellow")
## Warning: Removed 4 rows containing non-finite outside the scale range
## (`stat_count()`).

Histograma
ggplot(Planilia_Eleiçao_tabela_R) + aes(`Votos computados`) + geom_histogram(bins = 15, color = "blue", fill = "yellow" )
## Warning: Removed 4 rows containing non-finite outside the scale range
## (`stat_bin()`).
