From edd at debian.org  Fri Dec  2 19:54:25 2016
From: edd at debian.org (Dirk Eddelbuettel)
Date: Fri, 2 Dec 2016 12:54:25 -0600
Subject: [Rd] unlist strips date class
In-Reply-To: <CAPekMC=Od4ib7QJbpk8iGm9woUB4bzM+5BYq3vLqH_4u9ApXNA@mail.gmail.com>
References: <CAPekMC=Od4ib7QJbpk8iGm9woUB4bzM+5BYq3vLqH_4u9ApXNA@mail.gmail.com>
Message-ID: <22593.50017.30472.297070@max.nulle.part>


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



[Rd] unlist strips date class
Dirk Eddelbuettel