[Rcpp-commits] r4510 - in pkg/RcppExamples: . R inst man src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 18 12:36:17 CEST 2013


Author: romain
Date: 2013-09-18 12:36:17 +0200 (Wed, 18 Sep 2013)
New Revision: 4510

Added:
   pkg/RcppExamples/R/RcppExports.R
   pkg/RcppExamples/R/RcppListExample.R
   pkg/RcppExamples/man/RcppListExample.Rd
   pkg/RcppExamples/man/RcppNumericVectorExample.Rd
   pkg/RcppExamples/man/RcppRNGsExample.Rd
   pkg/RcppExamples/src/DataFrameExample.cpp
   pkg/RcppExamples/src/DateExample.cpp
   pkg/RcppExamples/src/ListExample.cpp
   pkg/RcppExamples/src/MatrixExample.cpp
   pkg/RcppExamples/src/NumericVectorExample.cpp
   pkg/RcppExamples/src/RNGs.cpp
   pkg/RcppExamples/src/RcppExports.cpp
   pkg/RcppExamples/src/StringVectorExample.cpp
Removed:
   pkg/RcppExamples/R/RcppParamsExample.R
   pkg/RcppExamples/man/RcppDate.Rd
   pkg/RcppExamples/man/RcppParams.Rd
   pkg/RcppExamples/man/RcppRNGs.Rd
   pkg/RcppExamples/man/RcppResultSet.Rd
   pkg/RcppExamples/man/RcppVector.Rd
   pkg/RcppExamples/src/RcppDataFrame.cpp
   pkg/RcppExamples/src/RcppRNGs.cpp
   pkg/RcppExamples/src/newRcppDateExample.cpp
   pkg/RcppExamples/src/newRcppMatrixExample.cpp
   pkg/RcppExamples/src/newRcppParamsExample.cpp
   pkg/RcppExamples/src/newRcppStringVectorExample.cpp
   pkg/RcppExamples/src/newRcppVectorExample.cpp
Modified:
   pkg/RcppExamples/DESCRIPTION
   pkg/RcppExamples/NAMESPACE
   pkg/RcppExamples/R/RcppDataFrame.R
   pkg/RcppExamples/R/RcppDateExample.R
   pkg/RcppExamples/R/RcppMatrixExample.R
   pkg/RcppExamples/R/RcppRNGs.R
   pkg/RcppExamples/R/RcppStringVectorExample.R
   pkg/RcppExamples/R/RcppVectorExample.R
   pkg/RcppExamples/inst/NEWS.Rd
   pkg/RcppExamples/man/RcppDataFrame.Rd
Log:
update the package so that it uses attributes

Modified: pkg/RcppExamples/DESCRIPTION
===================================================================
--- pkg/RcppExamples/DESCRIPTION	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/DESCRIPTION	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,6 +1,6 @@
 Package: RcppExamples
 Title: Examples using Rcpp to interface R and C++ 
-Version: 0.1.6
+Version: 0.1.6.1
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois
 Maintainer: Dirk Eddelbuettel <edd at debian.org>
@@ -11,7 +11,7 @@
  Note that the documentation in this package currently does not cover all the
  features in the package. It is not even close. On the other hand, the site
  http://gallery.rcpp.org is regrouping a number of examples for Rcpp.
-Depends: R (>= 2.11.0), Rcpp (>= 0.9.9)
+Depends: R (>= 2.15.1), Rcpp (>= 0.10.4.5)
 LinkingTo: Rcpp
 Suggests: RUnit 
 URL: http://dirk.eddelbuettel.com/code/rcpp.html, http://romainfrancois.blog.free.fr/index.php?category/R-package/Rcpp

Modified: pkg/RcppExamples/NAMESPACE
===================================================================
--- pkg/RcppExamples/NAMESPACE	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/NAMESPACE	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,13 +1,11 @@
 useDynLib(RcppExamples)
 
-export(#RcppExample,
-       #print.RcppExample,
-       RcppDataFrame,
+export(RcppDataFrame,
        RcppDateExample,
-       RcppParamsExample,
-       RcppVectorExample,
+       RcppListExample,
+       RcppNumericVectorExample,
        RcppMatrixExample,
-       RcppRNGs,
+       RcppRNGsExample,
        RcppStringVectorExample
 )
 

Modified: pkg/RcppExamples/R/RcppDataFrame.R
===================================================================
--- pkg/RcppExamples/R/RcppDataFrame.R	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/R/RcppDataFrame.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,22 +1,21 @@
-
-## RcppDataFrame.R: Rcpp R/C++ interface class library DataFrame example
+## RcppDataFrame.R: DataFrame example
 ##
-## Copyright (C) 2011        Dirk Eddelbuettel and Romain Francois
+## Copyright (C) 2011 - 2013        Dirk Eddelbuettel and Romain Francois
 ##
-## This file is part of Rcpp.
+## This file is part of RcppExamples.
 ##
-## Rcpp is free software: you can redistribute it and/or modify it
+## RcppExamples is free software: you can redistribute it and/or modify it
 ## under the terms of the GNU General Public License as published by
 ## the Free Software Foundation, either version 2 of the License, or
 ## (at your option) any later version.
 ##
-## Rcpp is distributed in the hope that it will be useful, but
+## RcppExamples is distributed in the hope that it will be useful, but
 ## WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
 ##
 ## You should have received a copy of the GNU General Public License
-## along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+## along with RcppExamples.  If not, see <http://www.gnu.org/licenses/>.
 
 RcppDataFrame <- function() {
 
@@ -30,8 +29,8 @@
     print(D)
 
     ## Make the call...
-    val <- .Call("RcppDataFrame", D, PACKAGE="RcppExamples")
-
+    val <- DataFrameExample(D)
+    
     cat("\nAfter call, original and new data frames:\n")
     print(val)
 

Modified: pkg/RcppExamples/R/RcppDateExample.R
===================================================================
--- pkg/RcppExamples/R/RcppDateExample.R	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/R/RcppDateExample.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,23 +1,23 @@
 
-## RcppDateExample.R: Rcpp R/C++ interface class library RcppDate example
+## RcppDateExample.R: RcppDate example
 ##
 ## Copyright (C) 2008        Dirk Eddelbuettel
-## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois
+## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
 ##
-## This file is part of Rcpp.
+## This file is part of RcppExamples.
 ##
-## Rcpp is free software: you can redistribute it and/or modify it
+## RcppExamples is free software: you can redistribute it and/or modify it
 ## under the terms of the GNU General Public License as published by
 ## the Free Software Foundation, either version 2 of the License, or
 ## (at your option) any later version.
 ##
-## Rcpp is distributed in the hope that it will be useful, but
+## RcppExamples is distributed in the hope that it will be useful, but
 ## WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
 ##
 ## You should have received a copy of the GNU General Public License
-## along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+## along with RcppExamples.  If not, see <http://www.gnu.org/licenses/>.
 
 RcppDateExample <- function(dv, dtv) {
 
@@ -33,7 +33,7 @@
     }
 
     ## Make the call...
-    val <- .Call("newRcppDateExample", dv, dtv, PACKAGE="RcppExamples")
+    val <- DateExample( dv, dtv )
     val
 }
 

Added: pkg/RcppExamples/R/RcppExports.R
===================================================================
--- pkg/RcppExamples/R/RcppExports.R	                        (rev 0)
+++ pkg/RcppExamples/R/RcppExports.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -0,0 +1,27 @@
+# This file was generated by Rcpp::compileAttributes
+# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
+
+DataFrameExample <- function(DF) {
+    .Call('RcppExamples_DataFrameExample', PACKAGE = 'RcppExamples', DF)
+}
+
+DateExample <- function(dv, dtv) {
+    .Call('RcppExamples_DateExample', PACKAGE = 'RcppExamples', dv, dtv)
+}
+
+ListExamples <- function(rparam) {
+    .Call('RcppExamples_ListExamples', PACKAGE = 'RcppExamples', rparam)
+}
+
+newRcppMatrixExample <- function(orig) {
+    .Call('RcppExamples_newRcppMatrixExample', PACKAGE = 'RcppExamples', orig)
+}
+
+NumericVectorExample <- function(orig) {
+    .Call('RcppExamples_NumericVectorExample', PACKAGE = 'RcppExamples', orig)
+}
+
+RcppRNGs <- function(n) {
+    .Call('RcppExamples_RcppRNGs', PACKAGE = 'RcppExamples', n)
+}
+

Copied: pkg/RcppExamples/R/RcppListExample.R (from rev 4501, pkg/RcppExamples/R/RcppParamsExample.R)
===================================================================
--- pkg/RcppExamples/R/RcppListExample.R	                        (rev 0)
+++ pkg/RcppExamples/R/RcppListExample.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -0,0 +1,37 @@
+
+## RcppListExample.R: RcppParams example
+##
+## Copyright (C) 2008        Dirk Eddelbuettel
+## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
+##
+## This file is part of RcppExamples.
+##
+## RcppExamples is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 2 of the License, or
+## (at your option) any later version.
+##
+## RcppExamples is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with RcppExamples.  If not, see <http://www.gnu.org/licenses/>.
+
+RcppListExample <- function(params) {
+
+    ## Check that params is properly set.
+    if (missing(params)) {
+        cat("\nIn R, setting default argument for params\n")
+        params <- list(method='BFGS',
+                       tolerance=1.0e-8,
+                       maxIter=1000,
+                       startDate=as.Date('2006-7-15'))
+    }
+
+    ## Make the call...
+    val <- ListExamples( params)
+    val
+}
+

Modified: pkg/RcppExamples/R/RcppMatrixExample.R
===================================================================
--- pkg/RcppExamples/R/RcppMatrixExample.R	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/R/RcppMatrixExample.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,23 +1,23 @@
 
-## RcppMatrixExample.R: Rcpp R/C++ interface class library RcppMatrix example
+## RcppMatrixExample.R: RcppMatrix example
 ##
 ## Copyright (C) 2008        Dirk Eddelbuettel
-## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois
+## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
 ##
-## This file is part of Rcpp.
+## This file is part of RcppExamples.
 ##
-## Rcpp is free software: you can redistribute it and/or modify it
+## RcppExamples is free software: you can redistribute it and/or modify it
 ## under the terms of the GNU General Public License as published by
 ## the Free Software Foundation, either version 2 of the License, or
 ## (at your option) any later version.
 ##
-## Rcpp is distributed in the hope that it will be useful, but
+## RcppExamples is distributed in the hope that it will be useful, but
 ## WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
 ##
 ## You should have received a copy of the GNU General Public License
-## along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+## along with RcppExamples.  If not, see <http://www.gnu.org/licenses/>.
 
 RcppMatrixExample <- function(mat=matrix(seq(1,9)^2, ncol=3)) {
     ## Make the call...

Deleted: pkg/RcppExamples/R/RcppParamsExample.R
===================================================================
--- pkg/RcppExamples/R/RcppParamsExample.R	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/R/RcppParamsExample.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,37 +0,0 @@
-
-## RcppParamsExample.R: Rcpp R/C++ interface class library RcppParams example
-##
-## Copyright (C) 2008        Dirk Eddelbuettel
-## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois
-##
-## This file is part of Rcpp.
-##
-## Rcpp is free software: you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 2 of the License, or
-## (at your option) any later version.
-##
-## Rcpp is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-RcppParamsExample <- function(params) {
-
-    ## Check that params is properly set.
-    if (missing(params)) {
-        cat("\nIn R, setting default argument for params\n")
-        params <- list(method='BFGS',
-                       tolerance=1.0e-8,
-                       maxIter=1000,
-                       startDate=as.Date('2006-7-15'))
-    }
-
-    ## Make the call...
-    val <- .Call("newRcppParamsExample", params, PACKAGE="RcppExamples")
-    val
-}
-

Modified: pkg/RcppExamples/R/RcppRNGs.R
===================================================================
--- pkg/RcppExamples/R/RcppRNGs.R	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/R/RcppRNGs.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,25 +1,25 @@
-## RcppRNGs.R: Rcpp R/C++ interface class library RNGs example
+## RcppRNGs.R: RNGs example
 ##
-## Copyright (C) 2012        Dirk Eddelbuettel and Romain Francois
+## Copyright (C) 2012 - 2013        Dirk Eddelbuettel and Romain Francois
 ##
-## This file is part of Rcpp.
+## This file is part of RcppExamples.
 ##
-## Rcpp is free software: you can redistribute it and/or modify it
+## RcppExamples is free software: you can redistribute it and/or modify it
 ## under the terms of the GNU General Public License as published by
 ## the Free Software Foundation, either version 2 of the License, or
 ## (at your option) any later version.
 ##
-## Rcpp is distributed in the hope that it will be useful, but
+## RcppExamples is distributed in the hope that it will be useful, but
 ## WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
 ##
 ## You should have received a copy of the GNU General Public License
-## along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+## along with RcppExamples.  If not, see <http://www.gnu.org/licenses/>.
 
-RcppRNGs <- function(n) {
+RcppRNGsExample <- function(n) {
     ## Make the call...
-    df <- .Call("RcppRNGs", n, PACKAGE="RcppExamples")
+    df <- RcppRNGs( n )
     df
 }
 

Modified: pkg/RcppExamples/R/RcppStringVectorExample.R
===================================================================
--- pkg/RcppExamples/R/RcppStringVectorExample.R	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/R/RcppStringVectorExample.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -2,22 +2,22 @@
 ## RcppStringVectorExample.R: Rcpp R/C++ interface class library
 ##
 ## Copyright (C) 2008        Dirk Eddelbuettel
-## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois
+## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
 ##
-## This file is part of Rcpp.
+## This file is part of RcppExamples.
 ##
-## Rcpp is free software: you can redistribute it and/or modify it
+## RcppExamples is free software: you can redistribute it and/or modify it
 ## under the terms of the GNU General Public License as published by
 ## the Free Software Foundation, either version 2 of the License, or
 ## (at your option) any later version.
 ##
-## Rcpp is distributed in the hope that it will be useful, but
+## RcppExamples is distributed in the hope that it will be useful, but
 ## WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
 ##
 ## You should have received a copy of the GNU General Public License
-## along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+## along with RcppExamples.  If not, see <http://www.gnu.org/licenses/>.
 
 RcppStringVectorExample <- function(vec=c("Tick", "Tack", "Tock")) {
     ## Make the call...

Modified: pkg/RcppExamples/R/RcppVectorExample.R
===================================================================
--- pkg/RcppExamples/R/RcppVectorExample.R	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/R/RcppVectorExample.R	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,27 +1,27 @@
 
-## RcppVectorExample.R: Rcpp R/C++ interface class library RcppVector example
+## RcppVectorExample.R: RcppVector example
 ##
 ## Copyright (C) 2008        Dirk Eddelbuettel
-## Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois
+## Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
 ##
-## This file is part of Rcpp.
+## This file is part of RcppExamples.
 ##
-## Rcpp is free software: you can redistribute it and/or modify it
+## RcppExamples is free software: you can redistribute it and/or modify it
 ## under the terms of the GNU General Public License as published by
 ## the Free Software Foundation, either version 2 of the License, or
 ## (at your option) any later version.
 ##
-## Rcpp is distributed in the hope that it will be useful, but
+## RcppExamples is distributed in the hope that it will be useful, but
 ## WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
 ##
 ## You should have received a copy of the GNU General Public License
-## along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+## along with RcppExamples.  If not, see <http://www.gnu.org/licenses/>.
 
-RcppVectorExample <- function(vec=seq(1,9)^2) {
+RcppNumericVectorExample <- function(vec=seq(1,9)^2) {
 
     ## Make the call...
-    val <- .Call("newRcppVectorExample", vec, PACKAGE="RcppExamples")
+    val <- NumericVectorExample(vec)
     val
 }

Modified: pkg/RcppExamples/inst/NEWS.Rd
===================================================================
--- pkg/RcppExamples/inst/NEWS.Rd	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/inst/NEWS.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -2,6 +2,13 @@
 \title{News for Package 'RcppExamples'}
 \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
 
+\section{Changes in RcppExamples version 0.1.7 (future)}{
+  \itemize{
+    \item Using attributes everywhere. This package's purpose is to show 
+    our recommended way to use Rcpp. This is it. 
+  }
+}
+
 \section{Changes in RcppExamples version 0.1.6 (2013-01-15)}{
   \itemize{
     \item Moved \code{NEWS.Rd} from top-level directory to correct

Modified: pkg/RcppExamples/man/RcppDataFrame.Rd
===================================================================
--- pkg/RcppExamples/man/RcppDataFrame.Rd	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/man/RcppDataFrame.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -17,7 +17,7 @@
 
   \preformatted{%
       // construct the data.frame object
-      Rcpp::DataFrame DF = Rcpp::DataFrame(Dsexp);
+      Rcpp::DataFrame DF(Dsexp);
 
       // and access each column by name
       Rcpp::IntegerVector a = DF["a"];

Deleted: pkg/RcppExamples/man/RcppDate.Rd
===================================================================
--- pkg/RcppExamples/man/RcppDate.Rd	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/man/RcppDate.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,97 +0,0 @@
-\name{RcppDate}
-\alias{RcppDate}
-\alias{RcppDatetime}
-\alias{RcppDateVector}
-\alias{RcppDatetimeVector}
-\alias{RcppDateExample}
-\title{C++ classes for interfacing date and datetime R objects}
-\description{
-  \code{RcppDate}, \code{RcppDatetime}, \code{RcppDateVector} and
-  \code{RcppDatetimeVector} are C++ classes defined in their respective
-  headers files.  They are part of the 'classic' Rcpp API. These classes
-  pass scalars and vectors of \R objects of types \code{Date} and
-  \code{POSIXct}, respectively, to C++ via the \code{.Call()} function
-  interface.  
-  
-  Member functions are provided to query the dimension of the vector or
-  matrix object, convert it in a corresponding \code{C} representation.
-
-  \R objects of type \code{Date}, and hence the \code{RcppDate} and
-  \code{RcppDateVector} objects, are internally represented as an
-  integer counting days since the epoch, i.e. January 1,
-  1970. Similarly, \R objects of type \code{POSIXct} and the
-  \code{RcppDatetime} and \code{RcppDatetimeVector} objects, are
-  internally represented as seconds since the epoch.  However, \R
-  extends the POSIX standard by using a double leading to microsecond
-  precision in timestamps. This is fully supported by \code{Rcpp} as
-  well.
-
-  The new API currently has the classes \code{Rcpp::Date}, \code{Rcpp::Datetime}, 
-  \code{Rcpp::DateVector} and \code{Rcpp::DatetimeVector} which are preferred
-  for new developments, but currently less documented. 
-}
-\details{
-  Usage of the \code{RcppDate}, \code{RcppDatetime} (and their vector
-  extensions) in \code{C++} is fully defined in the respective header
-  files \code{RcppDate.h} and \code{RcppDatetime.h}. 
-
-  As example, consider a call from \R to \code{C++} such as
-
-  \preformatted{
-  # an R example passing one type of each class to a function
-  # someFunction in package somePackage
-  val <- .Call("someFunction",
-               Sys.Date(),      # current date
-	           Sys.time(), 	    # current timestamp
-	           as.Date("2000-02-25")
-	             + 0:5,         # date vector
-	           ISOdatetime(1999,12,31,23,59,0)
-	             + (0:5)*0.250, # datetime vector
-   	           PACKAGE="somePackage")
-  }
-
-  At the \code{C++} level, the corresponding code to assign these parameter to
-  \code{C++} objects is can be as follows::
-  \preformatted{%
-  SEXP someFunction(SEXP ds, SEXP dts,
-                    SEXP dvs, SEXP dtvs) {
-
-    RcppDate           d(ds);  		      
-    RcppDatetime       dt(dts);
-    RcppDateVector     dv(dvs);
-    RcppDatetimeVector dtv(dtvs);
-  }
-  }
-
-  Standard accessor functions are defined, see \code{RcppDate.h} and
-  \code{RcppDatetime.h} for details.
-
-  Objects of these types can also be returned via \code{RcppResultSet}. 
-
-}
-\references{
-  \emph{Writing R Extensions}, available at \url{http:www.r-project.org}.
-}
-\seealso{
-  \code{RcppResultSet}.
-}
-\author{Dominick Samperi wrote the initial versions of Rcpp (and
-  RcppTemplate) during 2005 and 2006.  Dirk Eddelbuettel made some
-  additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain
-  Francois have been extending Rcpp since 2009.
-}
-\examples{
-
-# set up date and datetime vectors
-dvec <- Sys.Date() + -2:2
-dtvec <- Sys.time() + (-2:2)*0.5
-
-# call the underlying  C++ function
-result <- RcppDateExample(dvec, dtvec)
-
-# inspect returned object
-result
-}
-\keyword{programming}
-\keyword{interface}
-

Copied: pkg/RcppExamples/man/RcppListExample.Rd (from rev 4501, pkg/RcppExamples/man/RcppParams.Rd)
===================================================================
--- pkg/RcppExamples/man/RcppListExample.Rd	                        (rev 0)
+++ pkg/RcppExamples/man/RcppListExample.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -0,0 +1,45 @@
+\name{RcppListExample}
+\alias{RcppListExample}
+\title{Examples of uses of List}
+\description{
+    \code{List} is an \code{Rcpp} class that can be used to manipulate R lists.  
+}
+\arguments{
+  \item{params}{A heterogeneous list specifying \code{method} (string),
+    \code{tolerance} (double), \code{maxIter} (int) and \code{startDate}
+  (Date in R, RcppDate in C++).}
+}
+\value{
+  \code{RcppListExample} returns a list containing:
+  \item{method}{string input paramter}
+  \item{tolerance}{double input paramter}
+  \item{maxIter}{int input parameter}
+  \item{startDate}{Date type with starting date}
+  \item{params}{input parameter list (this is redundant because we
+    returned the input parameters above)}
+}
+\references{
+  \emph{Writing R Extensions}, available at \url{http:www.r-project.org}.
+}
+\author{Dominick Samperi wrote the initial versions of Rcpp (and
+  RcppTemplate) during 2005 and 2006.  Dirk Eddelbuettel made some
+  additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain
+  Francois have been extending Rcpp since 2009.
+}
+\examples{
+
+# set up some value
+params <- list(method='BFGS',
+               tolerance=1.0e-5,
+               maxIter=100,
+               startDate=as.Date('2006-7-15'))
+
+# call the underlying  C++ function
+result <- RcppListExample(params)
+
+# inspect returned object
+result
+
+}
+\keyword{programming}
+\keyword{interface}

Added: pkg/RcppExamples/man/RcppNumericVectorExample.Rd
===================================================================
--- pkg/RcppExamples/man/RcppNumericVectorExample.Rd	                        (rev 0)
+++ pkg/RcppExamples/man/RcppNumericVectorExample.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -0,0 +1,33 @@
+\name{RcppNumericVectorExample}
+\alias{RcppNumericVectorExample}
+\title{Rcpp NumericVector example}
+\description{
+  Example on how to use a NumericVector and manipulate it with the STL. 
+}
+\details{
+  \preformatted{%
+    NumericVector orig ; // from R
+    NumericVector vec(orig.size());		// create a target vector of the same size
+    
+    // we could query size via
+    //   int n = vec.size();
+    // and loop over the vector, but using the STL is so much nicer
+    // so we use a STL transform() algorithm on each element
+    std::transform(orig.begin(), orig.end(), vec.begin(), sqrt_double );
+
+    List result = List::create(
+        Named( "result" ) = vec, 
+        Named( "original" ) = orig
+    ) ;
+    return result ;
+  }
+
+  As shown in the example section, provided the seed is reset, the exact
+  same draws can be obtained in R itself -- which is important for reproducibility.
+}
+\author{Dirk Eddelbuettel and Romain Francois}
+\examples{
+    RcppNumericVectorExample( seq(1,9)^2 )
+}
+\keyword{programming}
+\keyword{interface}

Deleted: pkg/RcppExamples/man/RcppParams.Rd
===================================================================
--- pkg/RcppExamples/man/RcppParams.Rd	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/man/RcppParams.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,95 +0,0 @@
-\name{RcppParams}
-\alias{RcppParams}
-\alias{RcppParamsExample}
-\title{C++ class for receiving (scalar) parameters from R}
-\description{
-  \code{RcppParams} is a C++ class defined in \code{Rcpp.h} that receive
-  any number of scalar parameters of types in a single named list object
-  from \R through the \code{.Call()} function.
-  
-  The parameters can be of different types that are limited to the \R
-  types \code{numeric}, \code{integer}, \code{character}, \code{logical}
-  or \code{Date}. These types are mapped into, respectively, the
-  corresponding C++ types \code{double},  \code{int}, \code{string},
-  \code{bool} and \code{Date} (a custom class defined by \code{Rcpp}.
-  
-  \code{RcppParams} is part of the old Rcpp API, and should be replace by 
-  \code{Rcpp::List} which is more flexible and can be used for both inputs and
-  outputs. \code{RcppParams} is retained for backwards compatibility, but 
-  should be avoided in new projects and replaced in old projects.
-}
-\arguments{
-  \item{params}{A heterogeneous list specifying \code{method} (string),
-    \code{tolerance} (double), \code{maxIter} (int) and \code{startDate}
-  (Date in R, RcppDate in C++).}
-}
-\value{
-  \code{RcppExample} returns a list containing:
-  \item{method}{string input paramter}
-  \item{tolerance}{double input paramter}
-  \item{maxIter}{int input parameter}
-  \item{startDate}{Date type with starting date}
-  \item{params}{input parameter list (this is redundant because we
-    returned the input parameters above)}
-}
-\details{
-  Usage of \code{RcppParams} from \R via \code{.Call()} is as follows:
-  \preformatted{%
-  # an R example passing one type of each class to a function
-  # someFunction in package somePackage
-  val <- .Call("someFunction",
-               list(pie=3.1415, magicanswer=42, sometext="foo",
-                    yesno=true, today=Sys.date()),
-		    PACKAGE="somePackage")
-  }
-
-  At the C++ level, the corresponding code to assign these parameter to
-  C++ objects is 
-  \preformatted{%
-  SEXP someFunction(SEXP params) {
-    RcppParams par(params);
-    double p   = par.getDoubleValue("pie");
-    int magic  = par.getIntValue("magicanswer");
-    string txt = par.getStringValue("sometext");
-    bool yn    = par.getBoolValue("yesno");
-    RcppDate d = par.getDateValue("today");
-    // some calculations ...
-    // some return values ...
-  }
-  }
-  As the lookup is driven by the names givem at the \R level, order is
-  not important.  It is however important that the types match. Errors
-  are typically caught and an exception is thrown. 
-
-  The class member function \code{checkNames} can be used to verify that the
-  \code{SEXP} object passed to the function contains a given set of
-  named object.
-}
-\references{
-  \emph{Writing R Extensions}, available at \url{http:www.r-project.org}.
-}
-\seealso{
-  \code{RcppExample}.
-}
-\author{Dominick Samperi wrote the initial versions of Rcpp (and
-  RcppTemplate) during 2005 and 2006.  Dirk Eddelbuettel made some
-  additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain
-  Francois have been extending Rcpp since 2009.
-}
-\examples{
-
-# set up some value
-params <- list(method='BFGS',
-               tolerance=1.0e-5,
-               maxIter=100,
-               startDate=as.Date('2006-7-15'))
-
-# call the underlying  C++ function
-result <- RcppParamsExample(params)
-
-# inspect returned object
-result
-
-}
-\keyword{programming}
-\keyword{interface}

Deleted: pkg/RcppExamples/man/RcppRNGs.Rd
===================================================================
--- pkg/RcppExamples/man/RcppRNGs.Rd	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/man/RcppRNGs.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,47 +0,0 @@
-\name{RcppRNGs}
-\alias{RcppRNGs}
-\title{Rcpp RNGs example}
-\description{
-  Rcpp sugar provides numerous p/q/d/r functions for numerous distributions.
-
-  This example shows (in the corresponding C++ code) how to draw from
-  three different distributions and returns a data frame.
-}
-\details{
-  The various header file, and the Rcpp sugar vignette, provide full
-  documentation for Rcpp sugar.
-
-  The C++ source file corresponding to the this function does the
-  following (inside of a \code{try/catch} block):
-
-  \preformatted{%
-        Rcpp::RNGScope scope;         		// needed when RNGs are drawn
-
-        int n = Rcpp::as<int>(ns); 		// length vector 
-        Rcpp::NumericVector rn = Rcpp::rnorm(n);
-        Rcpp::NumericVector rt = Rcpp::rt(n, 1.0);
-        Rcpp::NumericVector rp = Rcpp::rpois(n, 1.0);
-
-        // create a new data frame to return drawns
-        Rcpp::DataFrame NDF = 
-            Rcpp::DataFrame::create(Rcpp::Named("rnorm") =rn,
-                                    Rcpp::Named("rt")    =rt,
-                                    Rcpp::Named("rpois") =rp);
-
-        // and return old and new in list
-        return(NDF);
-  }
-
-  As shown in the example section, provided the seed is reset, the exact
-  same draws can be obtained in R itself -- which is important for reproducibility.
-}
-\author{Dirk Eddelbuettel and Romain Francois}
-\examples{
-  set.seed(42)
-  X <- RcppRNGs(10)
-  set.seed(42)
-  Y <- data.frame(rnorm=rnorm(10),rt=rt(10,1),rpois=rpois(10,1))
-  all.equal(X,Y)
-}
-\keyword{programming}
-\keyword{interface}

Copied: pkg/RcppExamples/man/RcppRNGsExample.Rd (from rev 4501, pkg/RcppExamples/man/RcppRNGs.Rd)
===================================================================
--- pkg/RcppExamples/man/RcppRNGsExample.Rd	                        (rev 0)
+++ pkg/RcppExamples/man/RcppRNGsExample.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -0,0 +1,47 @@
+\name{RcppRNGsExample}
+\alias{RcppRNGsExample}
+\title{Rcpp RNGs example}
+\description{
+  Rcpp sugar provides numerous p/q/d/r functions for numerous distributions.
+
+  This example shows (in the corresponding C++ code) how to draw from
+  three different distributions and returns a data frame.
+}
+\details{
+  The various header file, and the Rcpp sugar vignette, provide full
+  documentation for Rcpp sugar.
+
+  The C++ source file corresponding to the this function does the
+  following (inside of a \code{try/catch} block):
+
+  \preformatted{%
+        Rcpp::RNGScope scope;         		// needed when RNGs are drawn
+
+        int n = Rcpp::as<int>(ns); 		// length vector 
+        Rcpp::NumericVector rn = Rcpp::rnorm(n);
+        Rcpp::NumericVector rt = Rcpp::rt(n, 1.0);
+        Rcpp::NumericVector rp = Rcpp::rpois(n, 1.0);
+
+        // create a new data frame to return drawns
+        Rcpp::DataFrame NDF = 
+            Rcpp::DataFrame::create(Rcpp::Named("rnorm") =rn,
+                                    Rcpp::Named("rt")    =rt,
+                                    Rcpp::Named("rpois") =rp);
+
+        // and return old and new in list
+        return(NDF);
+  }
+
+  As shown in the example section, provided the seed is reset, the exact
+  same draws can be obtained in R itself -- which is important for reproducibility.
+}
+\author{Dirk Eddelbuettel and Romain Francois}
+\examples{
+  set.seed(42)
+  X <- RcppRNGsExample(10L)
+  set.seed(42)
+  Y <- data.frame(rnorm=rnorm(10),rt=rt(10,1),rpois=rpois(10,1))
+  all.equal(X,Y)
+}
+\keyword{programming}
+\keyword{interface}

Deleted: pkg/RcppExamples/man/RcppResultSet.Rd
===================================================================
--- pkg/RcppExamples/man/RcppResultSet.Rd	2013-09-18 09:57:17 UTC (rev 4509)
+++ pkg/RcppExamples/man/RcppResultSet.Rd	2013-09-18 10:36:17 UTC (rev 4510)
@@ -1,95 +0,0 @@
-\name{RcppResultSet}
-\alias{RcppResultSet}
-\title{C++ class for sending C++ objects back to R}
-\description{
-  \code{RcppResultSet} is a C++ class defined in \code{RcppResultSet.h} that can
-  assign any number of C++ objects to \R in a single named list object 
-  as the \code{SEXP} return value of a \code{.Call()} function call. It
-  is part of the classic API.
-  
-  The C++ objects can be of different types that are limited to 
-  types  \code{double},  \code{int}, \code{string}, vectors of
-  \code{double} or \code{int} (with explicit dimensions),
-  matrices of \code{double} or \code{int} (with explicit dimensions), 
-  STL vectors of \code{double}, \code{int} or \code{string}, STL
-  \sQuote{vector of vectors} of types \code{double} or \code{int} (all
-  with implicit dimensions), the internal types \code{RcppDate}, \code{RcppDateVector},
-  \code{RcppStringVector}, \code{RcppVector} of types \code{double} or
-  \code{int}, \code{RcppMatrix} of types \code{double} or \code{int}
-  as well \code{RcppFrame}, a type that can be converted into a
-  \code{data.frame}, and the \R type \code{SEXP}. 
-  
-  Where applicable, the \code{C++} types are automatically converted to the
-  corresponding \R types structures around types \code{numeric},
-  \code{integer}, or \code{character}.  The \code{C++} code can all be
-  retrieved in \R as elements of a named list object.
-
-  The new API has more generic templated functions.
-}
-\details{
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 4510


More information about the Rcpp-commits mailing list