My excel spreadsheet always imports to R with column headings like "44983" rather than the d/m/y format that I want. I want to fix this in R rather than in excel. My dataframe is called "backlog" and has 95 columns, the first one is 'Backlog 62d+' and the rest of the columns are these dates like "44983" which R has registered as characters.
I've tried the following code, but my dataframe still looks the same - the column headings haven't changed to date d/m/y format.
backlog <- read_excel("./Weekly/Weekly_Cancer_62d_PTL_Tracker.xlsx",
sheet = "Provider Trends", range = "B24:CR44" %>% setNames(., c('Backlog 62d+', format(as.Date(as.numeric(names(.)[-1]), origin = '1899-12-30'), '%m/%d/%Y'))))
Based on your comment, I believe this is what you are looking for, with a few transformations :