Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openxlsx having problems with detect dates

Tags:

r

excel

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.

like image 967
Alejandro Andrade Avatar asked Dec 11 '25 15:12

Alejandro Andrade


1 Answers

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

like image 92
Lefty Avatar answered Dec 13 '25 09:12

Lefty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!