I've got a list that is the result of the following command:
lapply(data$displayDate, function(x) as.Date(as.POSIXct(x, origin = "1970-01-01")))
That comes out looking like this:
> data$displayDateDay[1:10]
[[1]]
[1] "2015-05-02"
[[2]]
[1] "2015-05-10"
[[3]]
[1] "2015-05-10"
[[4]]
[1] "2015-05-10"
[[5]]
[1] "2015-05-11"
[[6]]
[1] "2015-05-12"
[[7]]
[1] "2015-05-12"
[[8]]
[1] "2015-05-13"
[[9]]
[1] "2015-05-13"
[[10]]
[1] "2015-05-26"
This is all well and good but I can't figure out how to get this back into a property column vector in my data table. If I try to unlist
this list, here's what I get:
> unlist(testVector)
[1] 16557 16565 16565 16565 16566 16567 16567 16568 16568 16581
The class is numeric, whereas I wanted a date. Why is this happening, and how can I achieve a vector of dates?