Re: [Rcpp-devel] Transform arbitrary R object into std::vector>

2016-05-19 Thread Sameer D'Costa
On Thu, May 19, 2016 at 7:07 AM Dirk Eddelbuettel wrote: > > I'd consider Rcpp::Function as a last resort. You do not need it here. > Yes I don't like using Rcpp:Function either however it isn't easy to convert a data.frame into matrix in Rcpp. You have to write code to deal with factors and non

Re: [Rcpp-devel] Transform arbitrary R object into std::vector>

2016-05-19 Thread Sameer D'Costa
Hi, Have you considered using the function as.matrix? It is an R function but you can call it from within your Rcpp code as well. Once you have a matrix you can use your matrix solution. Rgds Sameer On Thu, May 19, 2016 at 5:46 AM Paul Saary wrote: > Hello, > > I have been trying to solve this

Re: [Rcpp-devel] Manipulation of IntegerVector

2014-07-11 Thread Sameer D'Costa
On Fri, Jul 11, 2014 at 3:19 AM, Mario Deng wrote: > But when I do "matched[j+1] = matched[j]+1;" everything crashes, I don't > get any error informations etc. Also, is there a way to avoid that the R > instance/RStudio crashes? > I was able to compile and run part of your code on linux outside

Re: [Rcpp-devel] Rcpp packages that use Boost.Geometry?

2014-02-22 Thread Sameer D'Costa
Hi Robi, On Thu, Feb 20, 2014 at 11:31 AM, Robi Ragan wrote: > > I am trying to write custom as<>() and wrap() converters for the most > common input and output geometry types used in that library. > > An example of the use would be: > > To use boost::geometry::convex_hull() to take in an n x 2

Re: [Rcpp-devel] Memory not mapped

2014-02-20 Thread Sameer D'Costa
One thing you can do is start with a little test case and run multiple times it to see if the segfault is really coming from where you think it is. /* test.cpp */ #include using namespace Rcpp; // [[Rcpp::export]] List entryexitclock( SEXP xts_obj_,int ent_col, int exit_col, double clock_limit,

Re: [Rcpp-devel] Rolling ADF test

2014-02-12 Thread Sameer D'Costa
On Wed, Feb 12, 2014 at 2:58 AM, Hideyoshi Maeda wrote: > Dear Rcpp-devel list, > > Wasn't sure if this got sent last time as I didn't get a response. > For next time, you can check the archives if you are not sure if your message was sent to the list. http://lists.r-forge.r-project.org/pipermail

[Rcpp-devel] Exporting C++ enums to R

2013-08-05 Thread Sameer D'Costa
Hi, I have an enum defined in a C++ library that I would like to export to R. I saw some references to enums in pkg/Rcpp/inst/include/Rcpp/module/Module.h but I could not find any examples of enums being used. Through trial and error I figured out that I could create a dummy class and add the enum

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
On Thu, May 2, 2013 at 3:06 PM, Dirk Eddelbuettel wrote: > > On 2 May 2013 at 14:33, Sameer D'Costa wrote: > | Thanks for the reply Dirk. > | > | On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: > | > > | > Hi Sameer, > | > > | > On 2 May 201

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
Thanks for the reply Dirk. On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: > > Hi Sameer, > > On 2 May 2013 at 10:16, Sameer D'Costa wrote: > | Hi, > | > | I am trying to return several Armadillo matrices back to R and to set > | the names for the rows and

[Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
Hi, I am trying to return several Armadillo matrices back to R and to set the names for the rows and the columns of each matrix. I have tried converting each Armadillo matrix to a NumericMatrix and then setting the dimnames on that before returning a list to R. This seems to work (see snippet belo