[Rd] Wishlist: abs method for difftime

From: Stephen D. Weigand <weigand.stephen_at_charter.net>
Date: Fri 08 Dec 2006 - 04:29:33 GMT

I am often taking the absolute value of a difftime object (after coercing it to numeric) in order to see how far apart in time two events are. For example, I might want to know if two events occurred within 100 days of each other using something like

abs(difftime(Date1, Date2)) < 100

Below is a suggestion for an abs.difftime:

abs.difftime <- function(x)

               class = class(x),
               units = attr(x, "units"))

I think these changes to difftime.Rd would document this:

  1. Add \alias{abs.difftime}
  2. In the first paragraph of \details change

"There is a \code{\link{round}} method for objects of this class,
as well as..."


"There are \code{\link{round}} and \code{\link{abs}} methods for
objects of this class, as well as..."

Thanks for considering this,

Rochester, Minnesota, USA

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Dec 08 15:32:42 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 08 Dec 2006 - 15:30:50 GMT.

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