Re: [R] Round down to earliest hour or half hour

From: Jannis <bt_jannis_at_yahoo.de>
Date: Mon, 09 May 2011 16:48:54 +0100 (BST)


I would use package chron and trunc()....

One example from the help of trunc.times (modified):

lirary(chron)
tt <- times(c("12:13:14", "15:46:17"))
trunc(tt, times("00:30:00"))

HTH
Jannis

> Von: Schatzi <adele_thompson_at_cargill.com>
> Betreff: [R] Round down to earliest hour or half hour
> An: r-help_at_r-project.org
> Datum: Montag, 9. Mai, 2011 14:06 Uhr
> I have times and would like to round
> down to the earliest 30 minute
> increment. For instance, a time of
> 2011-04-28 09:02:00
> (the as.numeric value = 1303999320)
> I would like it to be rounded down to:
> 2011-04-28 09:00:00
> (the as.numeric value = 1303999200)
>
> Any ideas of how to do this?
>
> -----
> In theory, practice and theory are the same. In practice,
> they are not - Albert Einstein
> --
> View this message in context: http://r.789695.n4.nabble.com/Round-down-to-earliest-hour-or-half-hour-tp3509374p3509374.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help_at_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.
>



R-help_at_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. Received on Mon 09 May 2011 - 15:53:19 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 09 May 2011 - 16:00:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive