[GRASS-stats] sequence of dates by one hour

Roger Bivand Roger.Bivand at nhh.no
Wed Jan 16 13:31:49 EST 2008


On Tue, 15 Jan 2008, Matteo Dall'Amico wrote:

Matteo,

Could you please post this on R-help, if you need an answer from someone 
who uses these classes?

Roger


> Hello,
> I need to create a sequence of dates separated by one hour.
> I found in the examples of axis.POSIXct() that it is possible to create it:
>
> Examples
>
> with(beaver1, {
> time <- strptime(paste(1990, day, time %/% 100, time %% 100),
>                "%Y %j %H %M")
> plot(time, temp, type="l") # axis at 4-hour intervals.
> # now label every hour on the time axis
> plot(time, temp, type="l", xaxt="n")
> r <- as.POSIXct(round(range(time), "hours"))
> axis.POSIXct(1, at=seq(r[1], r[2], by="hour"), format="%H")
> })
>
>
> I tried, but I received the error:
>
> date_graph_in<-chron("1/11/1907","00:39:00",format = c(dates = "d/m/y", times 
> = "h:m:s"));
> date_graph_fin<-chron("1/11/1998","00:39:00",format = c(dates = "d/m/y", 
> times = "h:m:s"));
> data_seq<-seq(date_graph_in,date_graph_fin,by="hour")
>
> Error in seq.dates(date_graph_in, date_graph_fin, by = "hour") :
> 	 "by" must be one of days, weeks, months, or years
>
>
> It seems it is possible to create date sequences separated of days, weeks, 
> months or years but not for hours.
>
> Does someone know how to do it?
> Thanks in advance,
>
> Matteo
>
> ---------------------------------
> Matteo Dall'Amico
> PhD candidate
> CUDAM and department of Civil and Environmental Engineering
> Universita' degli Studi di Trento
> Via Mesiano 77 - 38050 Trento - Italy
> email: matteo.dallamico at ing.unitn.it
> Tel. +39 0461 882610
> Fax +39 0461 882672
> http://www.dottorato.it/trento/
> ---------------------------------
>
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the grass-stats mailing list