[Rcpp-devel] Create scalar values in Rcpp
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Mon Dec 10 17:43:48 CET 2018
Your use of the term "array" in this context suggests you still don't have a firm grasp of R data types. R arrays are vectors with dim attributes. What you want is to create an R vector with 1 element, as shown in the quick reference. [1]
[1] http://dirk.eddelbuettel.com/code/rcpp/Rcpp-quickref.pdf
On December 10, 2018 8:13:43 AM PST, Wolf Vollprecht <w.vollprecht at gmail.com> wrote:
>Hi,
>
>What's the canonical way of creating a scalar SEXP in Rcpp? E.g. I
>would
>like to store a single numeric / integer / complex ... value. I can
>create
>an array with 1 element, but I couldn't find a way to do it for a
>scalar
>(and I figured out later that a scalar is *not* the same as a 1element
>array even though they print the same).
>
>Any pointers?
>
>Thanks,
>
>Wolf
--
Sent from my phone. Please excuse my brevity.
More information about the Rcpp-devel
mailing list