'How to combine problems(x) as well as tables with read_csv(x) in R?
Being new to R I have a rather basic question, but I could not find the answer by browsing these forums.
I am trying to parse and append a few csv files, all having trailing comma errors. Therefore, I am converting all variables to characters. What I would like to achieve is to not only combine the data tables, but the problems(x) with that as well.
In example:
- I am parsing and combining CSVs located in a folder using this line:
RESULT_tables <- list.files(path = tables_location, pattern = "*.csv", full.names = TRUE) %>%
map_df(~read_csv(.x) %>% mutate(across(.fns = as.character))) %>%
type_convert()
- The console output shows the count of rows with parsing failures with each added table, but when I run the below line, hoping to get the parsing failure count across all tables involved, it only shows the problems for the first table that is added and then appended with the others:
problems(RESULT_tables)
Which makes sense too, but I wonder how I can output the total number of parsing errors for all tables combined. Any tips would be highly appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
