Last active
January 20, 2023 22:18
-
-
Save fernandobarbalho/795524b72639b4ad29237d10cd3ee0f9 to your computer and use it in GitHub Desktop.
Trata tabela pdf do centro de monitoração eletrônica disponibilziada pela PF em 20/01/2023
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("tabulizer") | |
library("tidyverse") | |
library(readr) | |
cime_total<- tabulizer::extract_text("cime-20.01.pdf") | |
pos_ini<- | |
str_length("Secretaria de Estado de Administração Penitenciária do Distrito Federal\r\nCentro de Monitoração Eletrônica - CIME\r\n") | |
cime_trabalho<- | |
str_sub(cime_total,pos_ini+1,str_length(cime_total)) | |
cime_trabalho<- | |
str_replace_all(cime_trabalho,"\\s(?=[:digit:])|(?<=[:digit:])\\s", ";") | |
cime_trabalho<- | |
str_replace_all(cime_trabalho,"Nome Data de Nascimento UF", "nome;data_nascimento;uf") | |
write(cime_trabalho, "cime_trabalho.csv", ) | |
df_cime <- read_delim("cime_trabalho.csv", | |
delim = ";", escape_double = FALSE, col_types = cols(data_nascimento = col_date(format = "%d.%m.%Y")), | |
trim_ws = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment