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)
