[Rcpp-devel] Getting an R option in Rcpp
Søren Højsgaard
sorenh at math.aau.dk
Sat Aug 1 18:15:09 CEST 2015
Something like
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
CharacterVector foo() {
Function opt("getOption");
CharacterVector x = opt("digits");
return x;
}
/*** R
foo()
*/
> foo()
[1] "7"
- all though the result is here a character.
Regards
Søren
From: rcpp-devel-bounces at lists.r-forge.r-project.org [mailto:rcpp-devel-bounces at lists.r-forge.r-project.org] On Behalf Of Rguy
Sent: 1. august 2015 08:07
To: Rcpp
Subject: [Rcpp-devel] Getting an R option in Rcpp
Can I access an R option from within an Rcpp function? I'd like the access to happen at runtime, not at compile time. Something like this:
if (getOption("my_option") == x) {
do this;
} else {
do that;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150801/3001dfd7/attachment.html>
More information about the Rcpp-devel
mailing list