From a296180@mica.fmr.com  Tue May 21 21:17:10 2002
From: a296180@mica.fmr.com (a296180@mica.fmr.com)
Date: Tue, 21 May 2002 22:17:10 +0200 (MET DST)
Subject: [Rd] I() fails on objects of class POSIXct (PR#1587)
Message-ID: <200205212017.WAA09766@pubhealth.ku.dk>

Although the documentation is somewhat sketchy, I() can be used to create
objects of class AsIs:

> I("a")
[1] "a"
attr(,"class")
[1] "AsIs"      "character"
> I(4)
[1] 4
attr(,"class")
[1] "AsIs"    "numeric"
> I(4 + 0i)
[1] 4+0i
attr(,"class")
[1] "AsIs"    "complex"
> 

This fails for objects of class POSIXct.

> class(ISOdate(2002, 5, 21))
[1] "POSIXt"  "POSIXct"
> I(ISOdate(2002, 5, 21))
Error in names(x) : evaluation is nested too deeply: infinite recursion?
>

Interestingly enough, it produces an (incorrect?) answer for objects of class
POSIXlt

> class(as.POSIXlt(ISOdate(2002, 5, 21)))
[1] "POSIXt"  "POSIXlt"
> I(as.POSIXlt(ISOdate(2002, 5, 21)))
[1] "  0" "  0" "  8" " 21" "  4" "102" "  2" "140" "  1"
> 

Of course, this may not be a bug since it is not clear that I() is documented
to do anything like this.

> R.version
         _                   
platform sparc-sun-solaris2.6
arch     sparc               
os       solaris2.6          
system   sparc, solaris2.6   
status                       
major    1                   
minor    5.0                 
year     2002                
month    04                  
day      29                  
language R                   

Regards,

David Kane

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] I() fails on objects of class POSIXct (PR#1587)
a296180@mica.fmr.com