libere-tes-chaine-de-mots/import_data/32_importation_linkedin_comments.R
2024-07-18 21:54:15 -04:00

19 lines
671 B
R

linkedin_data_path <- "import_data/data/LinkedIn/comments/Comments.csv"
library("readr")
library("magrittr")
library("dplyr")
# Read CSV file
ddd <- readr::read_delim(linkedin_data_path,
escape_backslash = TRUE,
trim_ws = TRUE,
skip_empty_rows = FALSE,
delim = ",")
# Remove carriage returns
ddd %>%
mutate(MessageFix = Message %>% stringr::str_replace_all(pattern = "[\r\n\t]+", replacement = " ")) %>%
select(-Message) -> ddd2
# Save the cleaned data to a new CSV file
ddd2 %>% write.csv("import_data/data/LinkedIn/comments/Comments-FIX.csv", row.names = FALSE)