I want to convert my integer column to Date. the integer number looks like this (20160101). When using the as.Date function and by typing the origin argument to be "2016-01-02" the generate new column has the following value which is wrong "55197-07-06". So it has nothing to do with the write value. What could be the mistake I tried so many codes and this is one of them:
data$newVar = as.Date(data$YearMonthDay, origin="2016-01-02")
Also, my dates are all in 2016 year so I want to format the date to include only the month and day.