0

I have several databases I want to merge based on several attributes. For the merging, I am using the left_join function.

One struggle I always have is with converting different date formats before using the function. I have both "YYYYMMDD" and "YYYYMM". The "DD" are always the last days of the respective month e.g. 2011-12-31 for YYYYMMDD and 201112 for YYYYMM. As I think its too difficult to associate the last day of the month to every YYYYMM entry, I decided to use YYYYMM as my standard. I struggle to get the YYYYMMDD converted into YYYYMM.

Dataset$Date <- as.double(Dataset$Date, format="%Y/%m")

Tried both as.date as well as as.double before using the code as well as different forms of the format. Code runs but the date still is 2011-12-31 rather than 201112.

Anything obvious I am missing?

Thanks and best, D.

dbraeuni
  • 11
  • 2

0 Answers0