I have date in Excel as follows, first col1
as char and from col2
to col5
is in date format (mm/dd/yyyy)
id 1/1/2016 2/1/2016 3/1/2016 4/1/2016 5/1/2016
1 23 545 33 55 66
2 454 536 66 80 11
3 83 585 9 10 19
I tried to import the above file in to R using readxl
library, and my result shows column names which are in date format shows as number in dataset,
How to import Excel date column with same format?
As the dataset is in excel format, we can read it with read_excel
and then change the column names to its original format
library(readxl)
library(dplyr)
read_excel("yourdata.xlsx" %>%
setNames(., c('id', format(as.Date(as.numeric(names(.)[-1]),
origin = '1899-12-30'), '%m/%d/%Y')))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With