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
just for your interest an alternative approach using lubridate and just keeping month and day.
tmp <- as.integer(x = 20160101)
tmp %>% lubridate::ymd() %>% format("%m-%d")
Please notice, that you will be left with just a string afterwards.
tmp %>% lubridate::ymd() %>% format("%m-%d") %>% is.Date()
Is going to be FALSE. Without the cutoff of the year it will be TRUE. So to keep the date format, like Tim mentioned, an alternative lubridate approach would be:
tmp %>% lubridate::ymd()