Re: [Rd] subset data.frame at C level

2020-06-24 Thread Morgan Morgan
Thank you Jim for the feedback. I actually implemented it the way I describe it in my first email and it seems fast enough for me. Just to give a bit of context I will need it at some point in package kit. I also implemented subset by row which I actually need more as I am working on a faster ver

Re: [Rd] subset data.frame at C level

2020-06-23 Thread Jim Hester
It looks to me like internally .subset2 uses `get1index()`, but this function is declared in Defn.h, which AFAIK is not part of the exported R API. Looking at the code for `get1index()` it looks like it just loops over the (translated) names, so I guess I just do that [0]. [0]: https://github.co

[Rd] subset data.frame at C level

2020-06-17 Thread Morgan Morgan
Hi, Hope you are well. I was wondering if there is a function at C level that is equivalent to mtcars$carb or .subset2(mtcars, "carb"). If I have the index of the column then the answer would be VECTOR_ELT(df, asInteger(idx)) but I was wondering if there is a way to do it directly from the name