[Rcpp-commits] r2530 - pkg/Rcpp/inst/doc/Rcpp-modules

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 26 12:50:20 CET 2010


Author: romain
Date: 2010-11-26 12:50:20 +0100 (Fri, 26 Nov 2010)
New Revision: 2530

Modified:
   pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
Log:
 nicer syntax for formal argument witrhout default

Modified: pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw	2010-11-26 11:47:30 UTC (rev 2529)
+++ pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw	2010-11-26 11:50:20 UTC (rev 2530)
@@ -464,8 +464,7 @@
 args( norm )
 @
 
-To set formal arguments without default values, 
-the R variable \texttt{R\_MissingArg} must be used. 
+To set formal arguments without default values, simply omit the rhs. 
 
 <<lang=cpp>>=
 using namespace Rcpp ;
@@ -476,7 +475,7 @@
 
 RCPP_MODULE(mod_formals2){
 	function( "norm", &norm, 
-	    List::create( _["x"] = R_MissingArg, _["y"] = 0.0 ), 
+	    List::create( _["x"], _["y"] = 0.0 ), 
 	    "documentation for norm"
 	) ;
 }
@@ -491,7 +490,7 @@
 
 RCPP_MODULE(mod_formals2){
 	function( "norm", &norm, 
-	    List::create( _["x"] = R_MissingArg, _["y"] = 0.0 ), 
+	    List::create( _["x"], _["y"] = 0.0 ), 
 	    "documentation for norm"
 	) ;
 }
@@ -503,8 +502,7 @@
 args( norm )
 @
 
-The ellipsis (\texttt{...}) can be used, although it must be 
-set to \texttt{R\_MissingArg}. 
+The ellipsis (\texttt{...}) can be used, without default value. 
 
 <<lang=cpp>>=
 using namespace Rcpp ;
@@ -515,7 +513,7 @@
 
 RCPP_MODULE(mod_formals3){
 	function( "norm", &norm, 
-	    List::create( _["x"] = R_MissingArg, _["..."] = R_MissingArg ), 
+	    List::create( _["x"], _["..."] ), 
 	    "documentation for norm"
 	) ;
 }
@@ -530,7 +528,7 @@
 
 RCPP_MODULE(mod_formals3){
 	function( "norm", &norm, 
-	    List::create( _["x"] = R_MissingArg, _["..."] = R_MissingArg ), 
+	    List::create( _["x"] , _["..."]  ), 
 	    "documentation for norm"
 	) ;
 }



More information about the Rcpp-commits mailing list