openxlsx having problems with detect dates

2019-08-23 06:18发布

I'm using the package openxlsx to open a .xlsx file into R. This is a basic example of the data I'm trying to read:

enter image description here

This is the code I use to read the excel:

read.xlsx("F:/Test.xlsx",colNames = T,detectDates = T)

but i get the following error:

Error in read.xlsx.default("F:/Test.xlsx", colNames = T, detectDates = T) : 
  basic_string::substr: __pos (which is 8) > this->size() (which is 2)

If I delete the first row of the excel I keep getting the same error. And it's really wired because the last time I run the script (2 weeks ago) the Excel was in the same format and I didn't get this error and I haven't updated R or Rstudio or the package.

标签: r excel
1条回答
别忘想泡老子
2楼-- · 2019-08-23 06:38

I had the same problem, I changed on excel the format date from: 09/20/2017 to 09/20/17 and read.xlsx worked.

查看更多
登录 后发表回答