Reputation: 960
When I use read_excel to import data from Excel to R, some numeric columns are automatically converted to dates.
# e.g.
5600 to 1915-05-01
Is there a way to turn of this feature? Other than using "col_types" argument in read_excel.
Upvotes: 0
Views: 3960
Reputation: 10855
The readxl
package, like readr
for raw data files, has a type guesser to determine how to read columns in an Excel spreadsheet. As noted in the package vignette, the guessing process is not perfect, especially as it relates to date formats because they are stored as a special type of number.
As stated in the package documentation (as well as the comments on the OP), the way to avoid inaccurate guesses from the column type guesser is to explicitly specify the column types with the col_types
argument on read_excel()
.
Upvotes: 2