> f = function(x) as.Date(as.character(x), format='%Y%m%d')
> f(20110606)
[1] "2011-06-06"
> sapply(20110606, f)
[1] 15131
Why 2 returned values are not the same. I need to apply this function to a long vector of dates, but I’m not getting dates with sapply()!
sapplyunlists lapply and in doing so unclasses the dateas @Joshua Ulrich noted there is no need to use apply type functions however for interest
would be one possible way to “unlist” the dates