On Oct 19, 2010, at 11:25 AM, Manta wrote:


Dear R users, I have the following script to create bins of specified time
intervals


bin_end=60/bin_size
bin_size=bin_size*100
h=seq(070000,180000,by=10000)
breaks=c()
for (i in h)
        {
        for (j in 0:(bin_end-1))
                {
                value=i+(bin_size)*j
                breaks=append(breaks,value)
                }
        }


I would like to plot then using the time as x-axis. I tried the following

prova=zoo(myseries,times(breaks))

but of course I got the plot with the time as 80000, 90000, 100000 and so on. I would like only 08:00, 09:00 and so on (maybe also the half hours).
How to do it?

You seen to be under the mistaken impression that the internal representation of DateTime classes of 08:00 would be 80000. Since the internal representation of time is in seconds, the even number hours would be at integer multiples of 60*60. In addition the conversion of numeric to string in this situation may present some need to check for missing leading "0"'s. You ether need to describe the data situation more completely or adjust your expectations (or both).

?as.POSIXct
?strptime

--
David.

Thanks for your help,
Marco

--
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002285.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.

David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to