Reputation: 401
I have a list of Dates which is returned by a function and looks like the following:
$`2014-03-02T05:20:13,2014-03-02T05:20:13`
[1] "2014-03-02" "2014-03-02"
$`2013-12-04T21:06:28,2013-12-04T21:06:37,2013-12-04T21:06:46,2013-12-04T21:06:49,2013-12-04T21:07:16,2014-01-09T16:20:55,2014-01-09T18:20:59,2014-01-09T18:21:08,2014-01-09T18:21:08`
[1] "2013-12-04" "2013-12-04" "2013-12-04"
[4] "2013-12-04" "2013-12-04" "2014-01-09"
[7] "2014-01-09" "2014-01-09" "2014-01-09"
I would like to put all the individual elements of the list into a vector of Dates. What is the best way to accomplish that?
Thanks!
Upvotes: 11
Views: 3137
Reputation: 181
Just another option
If your list of dates is called dateList, use the following:
Reduce(c, dateList)
Upvotes: 9
Reputation: 14366
To preserve the Date class, if your list is called d
you can use do.call(c, d)
.
Upvotes: 19