[R] array question

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 18 00:00:06 CET 2006


Please use POSIXct and not POSIXlt objects, which are lists.

On Tue, 17 Jan 2006, Chang Shen wrote:

> Hi all,
>
> I want to create an array of datetime.
>
> If I have a datetime object dt
>
>> dt <- strptime("10Jan2006 00:00:15", "%d%b%Y %H:%M:%S")
>> dt
> [1]"2006-01-10 00:00:15"
>
> I want to make an array of dt, say 100 size.  I got those error.
>
> [1] "2006-01-10 00:00:15"
>> dtarray<-array(dt, dim=c(100));
> Error in array(dt, dim = c(100)) : dim<- : dims [product 100] do not match
> the length of object [9]
>
>
>> dtarray<-array(, dim=c(100));
>> dtarray[1]<-dt;
> Warning message:
> number of items to replace is not a multiple of replacement length
>>
>
>
> Any help?
>
> Thanks
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list