[Rcpp-commits] r3762 - in pkg/RcppBDT: . R demo man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Sep 2 18:28:56 CEST 2012
Author: edd
Date: 2012-09-02 18:28:56 +0200 (Sun, 02 Sep 2012)
New Revision: 3762
Modified:
pkg/RcppBDT/ChangeLog
pkg/RcppBDT/R/zzz.R
pkg/RcppBDT/demo/RcppBDTtz.R
pkg/RcppBDT/man/bdtPt.Rd
Log:
format() and show() for ptime objects
Modified: pkg/RcppBDT/ChangeLog
===================================================================
--- pkg/RcppBDT/ChangeLog 2012-09-02 01:38:06 UTC (rev 3761)
+++ pkg/RcppBDT/ChangeLog 2012-09-02 16:28:56 UTC (rev 3762)
@@ -1,3 +1,7 @@
+2012-09-02 Dirk Eddelbuettel <edd at debian.org>
+
+ * R/zzz.R: show() and format() methods added for ptime and tz modules
+
2012-09-01 Dirk Eddelbuettel <edd at debian.org>
* inst/include/RcppBDT.h: Added declarations for two new templated
Modified: pkg/RcppBDT/R/zzz.R
===================================================================
--- pkg/RcppBDT/R/zzz.R 2012-09-02 01:38:06 UTC (rev 3761)
+++ pkg/RcppBDT/R/zzz.R 2012-09-02 16:28:56 UTC (rev 3762)
@@ -44,16 +44,22 @@
}) )
.format_date <- function(x, ...) format(x$getDate(), ...)
-.show_date <- function(object) print(object$getDate())
+.show_date <- function(object) print(object$getDate())
.format_tz <- function(x, ...) format(x$getRegion(), ...)
-.show_tz <- function(object) print(object$getRegion())
+.show_tz <- function(object) print(object$getRegion())
+.format_pt <- function(x, ...) format(x$getDatetime(), ...)
+.show_pt <- function(object) print(object$getDatetime())
+
+
## define an onLoad expression to set some methods
evalqOnLoad({
setMethod("show", "Rcpp_bdtDate", .show_date)
setMethod("show", "Rcpp_bdtTz", .show_tz)
- setGeneric("format", function(x,...) standardGeneric("format") )
- setMethod("format", "Rcpp_bdtDate", .format_date )
- setMethod("format", "Rcpp_bdtTz", .format_tz )
+ setMethod("show", "Rcpp_bdtPt", .show_pt)
+ setGeneric("format", function(x,...) standardGeneric("format"))
+ setMethod("format", "Rcpp_bdtDate", .format_date)
+ setMethod("format", "Rcpp_bdtTz", .format_tz)
+ setMethod("format", "Rcpp_bdtPt", .format_pt)
})
Modified: pkg/RcppBDT/demo/RcppBDTtz.R
===================================================================
--- pkg/RcppBDT/demo/RcppBDTtz.R 2012-09-02 01:38:06 UTC (rev 3761)
+++ pkg/RcppBDT/demo/RcppBDTtz.R 2012-09-02 16:28:56 UTC (rev 3762)
@@ -12,12 +12,16 @@
cat("zone std and dst abbreviation: ", tz$getStdZoneAbbrev(), "and", tz$getDstZoneAbbrev(), "\n")
cat("zone std and dst names: ", tz$getStdZoneName(), "and", tz$getDstZoneName(), "\n")
+ cat("\n")
# format() as cat() enforces txt
- cat("2012 year dst start and end: ", format(tz$getDstLocalStart(2012)), "and", format(tz$getDstLocalEnd(2012)), "\n")
+ cat("2012 year dst start: ", format(tz$getDstLocalStart(2012)), "\n")
+ cat("2012 year dst end: ", format(tz$getDstLocalEnd(2012)), "\n")
+ cat("\n")
cat("Offset to UTC (in seconds): ", tz$getUtcOffset(), "\n")
cat("DST offset (in seconds): ", tz$getDstOffset(), "\n")
+ cat("\n")
cat("Formal POSIX string of region: ", tz$getPosixString(), "\n")
cat("\n")
Modified: pkg/RcppBDT/man/bdtPt.Rd
===================================================================
--- pkg/RcppBDT/man/bdtPt.Rd 2012-09-02 01:38:06 UTC (rev 3761)
+++ pkg/RcppBDT/man/bdtPt.Rd 2012-09-02 16:28:56 UTC (rev 3762)
@@ -1,6 +1,8 @@
\name{bdtPt}
\alias{bdtPt}
\alias{Rcpp_bdtPt-class}
+\alias{show,Rcpp_bdtPt-method}
+\alias{format,Rcpp_bdtPt-method}
\docType{package}
\title{Rcpp module bdtPt for binding of Boost Date_Time ptime functionality}
\description{
@@ -14,6 +16,12 @@
seconds ought to be at a nano-second granularity; there may be
platforms not permitting this.
}
+\section{Method}{
+ \describe{
+ \item{show}{\code{signature(x = "Rcpp_bdtPt")}: prints a (BDTpt) ptime class object}
+ \item{format}{\code{signature(x = "Rcpp_bdtPt")}: formats a (BDTpt) ptime 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