Try this:
sapply(0:(length(DateTime3)-1), function(i)as.character(strptime(start,
"%m/%d/%Y %H:%M") + i * interval))
On Wed, Oct 13, 2010 at 8:51 AM, dpender <d.pender@civil.gla.ac.uk> wrote:
>
> I am trying to convert an array from numeric values back to date and time
> format. The code I have used is as follows;
>
> for (i in 0:(length(DateTime3)-1)) {
> DateTime3[i] <- (strptime(start, "%m/%d/%Y %H:%M")+
i*interval)
>
> where start <- [1] "1/1/1981 00:00"
>
> However the created array (DateTime3) contains [1,] 347156400 347157600
> 347158800 347160000 347161200 347162400 347163600 NA
>
> Does anyone know how I can change DateTime 3 to the same format as start?
>
> Thanks,
>
> Doug
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Date-Time-Objects-tp2993524p2993524.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]