2
A few days ago I asked a question in the stack, according to link. The reply I received from prof. @Marcus Nunes shows that less than 10% of lines have more than 15 tabs of the type ;
. In that case, I wish to erase all lines more than 15 ;
to separate columns. A first code to perform this cleanup and generate a new database follows below, however, it did not work properly. I would like to receive some suggestion on how to proceed to achieve my goal?
library("tidyverse")
library("stringr")
teste <- readLines("2019_Viagem.csv")
count <- str_count(teste, ';')
teste <- teste[count==15]
write.csv2(teste,"plan2019.csv",row.names = FALSE)
Diaria2019_Via <- "iconv -f ISO-8859-1 -t UTF-8 plan2019.csv"
Diaria2019 <- data.table::fread(Diaria2019_Via, dec = ",")
Very good @Rui Barradas, thank you!
– fsbmat