Peter Chen
Peter Chen

Reputation: 1484

Import data from excel but get warning messages

I import data from excel and I have multiple excel so I read at one time.
Here is my code:

library(readxl)
library(data.table)
file.list <- dir(path = "path/", pattern='\\.xlsx', full.names = T)
df.list <- lapply(file.list, read_excel)
data <- rbindlist(df.list)  

However, I get this warning messages between df.list <- lapply(file.list, read_excel) and data <- rbindlist(df.list).

Warning messages:
1: In read_xlsx_(path, sheet, col_names = col_names, col_types = col_types,  :
[3083, 9]: expecting date: got '2015/07/19'
2: In read_xlsx_(path, sheet, col_names = col_names, col_types = col_types,  :
[3084, 9]: expecting date: got '2015/07/20'

What's going on? How can I check and correct?

Upvotes: 2

Views: 1396

Answers (2)

C Lederman
C Lederman

Reputation: 29

It is not an elegant solution but use the parameter guess_max = "number of lines in your data file"; this eliminates the warnings and the side effects.

Upvotes: 1

Sarina
Sarina

Reputation: 558

According to my comment I submit this as an answer. Have you looked into your excel sheet at the respective lines? to me it seems that there is something going on there. maybe you have an empty cell before or after these lines, some space or anything like that... or the format of your date is different in these ones from what is in the other cells.

Upvotes: 1

Related Questions