[Rcpp-commits] r3763 - in pkg/RcppBDT: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 2 18:59:35 CEST 2012


Author: edd
Date: 2012-09-02 18:59:35 +0200 (Sun, 02 Sep 2012)
New Revision: 3763

Modified:
   pkg/RcppBDT/ChangeLog
   pkg/RcppBDT/R/zzz.R
   pkg/RcppBDT/man/bdtDu.Rd
Log:
format() and show() for duration objects


Modified: pkg/RcppBDT/ChangeLog
===================================================================
--- pkg/RcppBDT/ChangeLog	2012-09-02 16:28:56 UTC (rev 3762)
+++ pkg/RcppBDT/ChangeLog	2012-09-02 16:59:35 UTC (rev 3763)
@@ -1,6 +1,7 @@
 2012-09-02  Dirk Eddelbuettel  <edd at debian.org>
 
-	* R/zzz.R: show() and format() methods added for ptime and tz modules
+	* R/zzz.R: Added show() and format() methods for the ptime, du and tz
+	modules
 
 2012-09-01  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/RcppBDT/R/zzz.R
===================================================================
--- pkg/RcppBDT/R/zzz.R	2012-09-02 16:28:56 UTC (rev 3762)
+++ pkg/RcppBDT/R/zzz.R	2012-09-02 16:59:35 UTC (rev 3763)
@@ -52,14 +52,19 @@
 .format_pt <- function(x, ...) format(x$getDatetime(), ...)
 .show_pt   <- function(object) print(object$getDatetime())
 
+.format_du <- function(x, ...) format(as.difftime( x$getTotalSeconds( ) + x$getFractionalSeconds( ) / 1.0e9 , units="secs"))
+.show_du   <- function(object) print(as.difftime( object$getTotalSeconds( ) + object$getFractionalSeconds( ) / 1.0e9 , units="secs"))
 
+
 ## define an onLoad expression to set some methods
 evalqOnLoad({
     setMethod("show", "Rcpp_bdtDate", .show_date)
     setMethod("show", "Rcpp_bdtTz", .show_tz)
     setMethod("show", "Rcpp_bdtPt", .show_pt)
+    setMethod("show", "Rcpp_bdtDu", .show_du)
     setGeneric("format", function(x,...) standardGeneric("format"))
     setMethod("format", "Rcpp_bdtDate", .format_date)
     setMethod("format", "Rcpp_bdtTz", .format_tz)
     setMethod("format", "Rcpp_bdtPt", .format_pt)
+    setMethod("format", "Rcpp_bdtDu", .format_du)
 })

Modified: pkg/RcppBDT/man/bdtDu.Rd
===================================================================
--- pkg/RcppBDT/man/bdtDu.Rd	2012-09-02 16:28:56 UTC (rev 3762)
+++ pkg/RcppBDT/man/bdtDu.Rd	2012-09-02 16:59:35 UTC (rev 3763)
@@ -1,6 +1,8 @@
 \name{bdtDu}
 \alias{bdtDu}
 \alias{Rcpp_bdtDu-class}
+\alias{show,Rcpp_bdtDu-method}
+\alias{format,Rcpp_bdtDu-method}
 \docType{package}
 \title{Rcpp module bdtDu for binding of Boost Date_Time duration functionality}
 \description{
@@ -13,6 +15,12 @@
   be at a nano-second granularity; there may be platforms not permitting
   this.
 }
+\section{Method}{
+  \describe{
+    \item{show}{\code{signature(x = "Rcpp_bdtDu")}: prints a (BDTdu) duration class object}
+    \item{format}{\code{signature(x = "Rcpp_bdtDu")}: formats a (BDTdu) duration class object}
+  }
+}
 \details{
   Please consult the Boost documentation for (copious) details on the
   Date_Time library. See the Rcpp-modules vignette for details on Rcpp



More information about the Rcpp-commits mailing list