0

I have a date column in Microsoft Excel with dates in two different formats. Some dates have a year in the 1800s (e.g., 12/05/1888; whereas, all the other have a date after the 1900s (e.g., 3/6/59). I have thousands of dates.

I need to import the dates into R, but when I do each date is appearing as a five-digit number. My search of StackOverflow did not find a post that matched my situation.

When I format the column in Excel as "short date," here is what I see with the dates in the 1800s left-justified and the year shown as four digits in Excel and the dates after the 1800s right-justified with the year shown as two digits. Each date is on a separate line.

BIRTHDATE
12/05/1888
3/6/59
8/23/01
06/07/1888
11/19/77
6/23/52
07/09/1893
4/22/59
10/31/43
6/12/14
12/17/35
10/18/1869

When I convert the Excel column to text, here is what I see (each date is on a separate line):

BIRTHDATE
12/05/1888
21615
601
06/07/1888
28448
19168
07/09/1893
21662
16010
5277
13135
10/18/1869
17413

What can I do so that all the dates appear in correct date format in R?

r2evans
  • 141,215
  • 6
  • 77
  • 149
Metsfan
  • 510
  • 2
  • 8

0 Answers0