Hi all,
thanks for your responses. Indeed, R can be a little confusing coming from
C++ / Python :)
I am now creating a one-element vector, and that seems to work great for
xtensor-R!
Cheers,
Wolf
Am Mo., 10. Dez. 2018 um 18:56 Uhr schrieb Jeff Newmiller <
jdnew...@dcn.davis.ca.us>:
> I did not
I did not intend to shoot anyone... but my own learning curve led me to skip
over the clear descriptions in the "Introduction to R" document because I
thought I already understood the terminology. True, it happened a long time
ago, but it took me an embarrassingly long time to grok this because
Jeff,
On 10 December 2018 at 08:43, Jeff Newmiller wrote:
| 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.
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
On 10 December 2018 at 11:24, Avraham Adler wrote:
| There are no scalars in R; there are vectors of length 1.
Yep. An R feature, and gotcha if you come from somwhere else. See
R> a <- 1
R> is.vector(a)
[1] TRUE
R>
And while we can do this
R> Rcpp::cppFunction("double wolf(double x)
There are no scalars in R; there are vectors of length 1.
https://stat.ethz.ch/pipermail/r-help/2003-April/032010.html
Avi
On Mon, Dec 10, 2018 at 11:14 AM Wolf Vollprecht
wrote:
> Hi,
>
> What's the canonical way of creating a scalar SEXP in Rcpp? E.g. I would
> like to store a single numeric
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
ar