Re: [Rcpp-devel] Ranges and Casting

2021-01-16 Thread Francisco Bischoff
Hope it helps. > > > > Best, > > > > JJB > > > > *From: *Rcpp-devel on > behalf of Francisco Bischoff > *Date: *Friday, January 15, 2021 at 8:05 PM > *To: *Dirk Eddelbuettel > *Cc: *"rcpp-devel@lists.r-forge.r-project.org" < &g

Re: [Rcpp-devel] Ranges and Casting

2021-01-16 Thread Balamuta, James Joseph
helps. Best, JJB From: Rcpp-devel on behalf of Francisco Bischoff Date: Friday, January 15, 2021 at 8:05 PM To: Dirk Eddelbuettel Cc: "rcpp-devel@lists.r-forge.r-project.org" Subject: Re: [Rcpp-devel] Ranges and Casting Thanks for the tips. Still, Range() is the correct way to write

Re: [Rcpp-devel] Ranges and Casting

2021-01-15 Thread Francisco Bischoff
Thanks for the tips. Still, Range() is the correct way to write: NumericVector my_vec(200); my_vec(Range(0,10)) = 10; ? Thanks in advance -- Francisco Bischoff, MD, MSc Faculty of Medicine of the University of Porto, Portugal - Master of Medical Informatics | topic: time series - Research

Re: [Rcpp-devel] Ranges and Casting

2021-01-15 Thread Francisco Bischoff
Hello, About the Range() function, I think it should handle decreasing ranges too... But, idk if using Matlabs approach or R approach: R's: a <- 1 b <- 10 print(a:b) 1 2 3 4 5 6 7 8 9 10 print(b:a) 10 9 8 7 6 5 4 3 2 1 Matlab's a = 1; b = 10; disp(a:b); 1 2 3 4 5 6 7 8 9 10 disp(b:a); numeric(

Re: [Rcpp-devel] Ranges and Casting

2021-01-15 Thread Dirk Eddelbuettel
On 16 January 2021 at 01:35, Francisco Bischoff wrote: | About the Range() function, I think it should handle decreasing ranges | too... | But, idk if using Matlabs approach or R approach: | | R's: | | a <- 1 | b <- 10 | | print(a:b) | 1 2 3 4 5 6 7 8 9 10 | print(b:a) | 10 9 8 7 6 5 4 3 2 1 |

Re: [Rcpp-devel] Ranges and Casting

2021-01-05 Thread Dirk Eddelbuettel
Francisco, On 5 January 2021 at 13:58, Francisco Bischoff wrote: | First of all, let me thank all involved with the Rcpp package! | | I just have a (maybe silly) question, but I struggle with this frequently | in my codes: | | Range() vs IntegerVector | | One example is when I need a reverse i

[Rcpp-devel] Ranges and Casting

2021-01-05 Thread Francisco Bischoff
Hello everyone, First of all, let me thank all involved with the Rcpp package! I just have a (maybe silly) question, but I struggle with this frequently in my codes: Range() vs IntegerVector One example is when I need a reverse index, like R's 10:1, so I had to write my own function that return