[R] Request for some help: Error when joining multiple csv files together
Bhaskar Mitra
bh@@k@r@ko|k@t@ @end|ng |rom gm@||@com
Thu Jun 2 01:17:18 CEST 2022
Hello Everyone,
I have a bunch of csv files, all with common headers (d1, d2, d3, d4).
When I am trying to join the csv files together, with the following code
(shown below),
I am getting a warning when the files are joined. The values under columns
d3 and d4 are not joined properly.
The code and the error are given below. I would really appreciate some help
in this regard.
regards,
bhaskar
#---code--------------------------------
df <- list.files(pattern = "*.csv") %>%
lapply(read_csv) %>%
bind_rows
#---code--------------------------------
Header of each file:
d1 d2 d3 d4
3 4 NA NA
4 5 NA 7
5 6 8 8
6 7 8 NA
#--------------------------------------------------------
#Warning when the codes run --------------------------------------
Column specification
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
cols(
.default = col_double(),
name = col_character(),
d1 = col_datetime(format = ""),
d2 = col_character(),
d3 = col_logical(),
d4 = col_logical()
)
Warning: 48766 parsing failures.
* row* *col* * expected * *actual*
*file*
3529 d3 1/0/T/F/TRUE/FALSE 100 'file1.csv'
3529 d4 1/0/T/F/TRUE/FALSE 100 'file1.csv'
.... ..... .................. ...... ................................
[[alternative HTML version deleted]]
More information about the R-help
mailing list