[Rd] unlist strips date class
Dirk Eddelbuettel
edd at debian.org
Fri Dec 2 19:54:25 CET 2016
On 2 December 2016 at 10:45, Kenny Bell wrote:
| Is this a bug?
|
| > unlist(list(as.Date("2015-01-01")))
| [1] 16436
Not really, it is documented.
S3 classes operate via an attribute tag, and attributes get dropped by
certain base functions. I must have hit something like the following about a
thousand times by now:
R> for (i in as.Date("2015-01-01")+ 0:2) print(i)
[1] 16436
[1] 16437
[1] 16438
R>
Live and learn.
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the R-devel
mailing list