From pburns at pburns.seanet.com  Fri Jan 30 11:14:28 2009
From: pburns at pburns.seanet.com (Patrick Burns)
Date: Fri, 30 Jan 2009 10:14:28 +0000
Subject: [Rd] length of POSIXlt object (PR#13482)
In-Reply-To: <20090128221518.E0F0F282EFF0@mail.pubhealth.ku.dk>
References: <20090128221518.E0F0F282EFF0@mail.pubhealth.ku.dk>
Message-ID: <4982D304.1000309@pburns.seanet.com>

'The R Inferno' page 93 and page 99.


Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")

twoutopias at gmail.com wrote:
> The length() of a POSIXlt object is given as 9 regardless of the actual
> length. For example:
>
>   
>> make.date.time
>>     
> function (year=c(2006,2006),month=c(8,8),day=2:5,hour=13,minute=45)
> {# convert year, etc., into POSIXlt object
> #
> d=as.character(make.date(year,month,day))
> t=paste(hour,minute,sep=":")
> as.POSIXlt(paste(d,t))
> }
>   
>> t=make.date.time()
>> t
>>     
> [1] "2006-08-02 13:45:00" "2006-08-03 13:45:00" "2006-08-04 13:45:00"
> [4] "2006-08-05 13:45:00"
>   
>> length(t)
>>     
> [1] 9
>   
>> t[1]
>>     
> [1] "2006-08-02 13:45:00"
>   
>> length(t[1])
>>     
> [1] 9
>
>
>
>



[Rd] length of POSIXlt object (PR#13482)
Patrick Burns