Re: [Rcpp-devel] Negative vector lengths from rep_each

2018-10-29 Thread Dirk Eddelbuettel
On 29 October 2018 at 13:00, Barth Riley wrote: | Apologies for the misunderstanding. No worries. This can be tricky, and R (and Rcpp) make simple(r) things easy but sometimes you need to step back and review whether the tooling is appropriate. R had an identified weakness with int-based indexi

Re: [Rcpp-devel] Negative vector lengths from rep_each

2018-10-29 Thread Barth Riley
Apologies for the misunderstanding. Thanks Barth ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Negative vector lengths from rep_each

2018-10-29 Thread Dirk Eddelbuettel
On 29 October 2018 at 12:43, Barth Riley wrote: | Thanks, Dirk. Would it matter if I initialize the values in the array to missing (NA_REAL)? I think you misunderstood my previous email (which you chose not to quote). First: R> .Machine$integer.max [1] 2147483647 R> Second: R> Rcpp

Re: [Rcpp-devel] Negative vector lengths from rep_each

2018-10-29 Thread Barth Riley
Thanks, Dirk. Would it matter if I initialize the values in the array to missing (NA_REAL)? Barth ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Negative vector lengths from rep_each()

2018-10-29 Thread Dirk Eddelbuettel
On 29 October 2018 at 09:12, Barth Riley wrote: | Dear list | | I have written the following function to produce multidimensional arrays using Rcpp: | | NumericVector arrayFromVector(NumericVector input, IntegerVector dim) { | | // check for zero-length vectors | if(dim.length() == 0 ||

[Rcpp-devel] Negative vector lengths from rep_each()

2018-10-29 Thread Barth Riley
Dear list I have written the following function to produce multidimensional arrays using Rcpp: NumericVector arrayFromVector(NumericVector input, IntegerVector dim) { // check for zero-length vectors if(dim.length() == 0 || input.length() == 0) { return NULL; } long p = 1; f