[Rd] Could generic functions check different S3 methods for an object when one of them produces an error?

2019-06-18 Thread IAGO GINÉ VÁZQUEZ
Hi, Let's say one has an object with multiple classes, and a generic function to apply to it has associated S3 methods for more than one of those classes. Further, the method it chooses (I do not know how; some order in the class vector?) is not the suitable one and it produces an error. Would

Re: [Rd] Could generic functions check different S3 methods for an object when one of them produces an error?

2019-06-18 Thread Fox, John
Dear Iago, The R S3 object system works as expected here, using the first available method processing the class vector from left to right. The problem is that the broom package doesn't export the confint.geeglm() method but rather reserves it for internal use. I can't think why the package auth

Re: [Rd] Could generic functions check different S3 methods for an object when one of them produces an error?

2019-06-18 Thread Duncan Murdoch
On 17/06/2019 3:56 a.m., IAGO GINÉ VÁZQUEZ wrote: Hi, Let's say one has an object with multiple classes, and a generic function to apply to it has associated S3 methods for more than one of those classes. Further, the method it chooses (I do not know how; some order in the class vector?) is

[Rd] making a vignette optional

2019-06-18 Thread Therneau, Terry M., Ph.D. via R-devel
I had added a vignette to the coxme package and all worked well locally, but it failed at CRAN. The issue is that the vignette involves using coxme for pedigree data, it doesn't work without the kinship2 package, and I hadn't put in the necessary "if (require(" logic. The question is

Re: [Rd] making a vignette optional

2019-06-18 Thread Iñaki Ucar
On Tue, 18 Jun 2019 at 19:03, Therneau, Terry M., Ph.D. via R-devel wrote: > > I had added a vignette to the coxme package and all worked well locally, but > it failed at > CRAN. The issue is that the vignette involves using coxme for pedigree > data, it > doesn't work without the kinship2 p

[Rd] Fast way to call an R function from C++?

2019-06-18 Thread King Jiefei
Hi, I'm looking for a most efficient way to call an R function from C++ in a package. I know there are two functions (`R_forceAndCall` and `Rf_eval`) that can do the "call" part, but both are slow compared to calling the same function in R. I also try to use Rcpp and it is the worse one. Here is m

Re: [Rd] Fast way to call an R function from C++?

2019-06-18 Thread Kevin Ushey
Hi Jiefei, Calling into R from C++ code is more complicated than one might think. Please see Tomas Kalibera's post here: https://developer.r-project.org/Blog/public/2019/03/28/use-of-c---in-packages/index.html The Rcpp Function class is more expensive than a regular Rf_eval() because it tries to

Re: [Rd] Fast way to call an R function from C++?

2019-06-18 Thread Iñaki Ucar
For reference, your benchmark using UNWIND_PROTECT: > system.time(test(testFunc, evn$x)) user system elapsed 0.331 0.000 0.331 > system.time(test(C_test1, testFunc, evn$x)) user system elapsed 2.029 0.000 2.036 > system.time(test(C_test2, expr, evn)) user system elapsed 2

Re: [Rd] Fast way to call an R function from C++?

2019-06-18 Thread Iñaki Ucar
On Tue, 18 Jun 2019 at 19:41, King Jiefei wrote: > > [...] > > It is clear to see that calling an R function in R is the fast one, it is > about 5X faster than ` R_forceAndCall ` and ` Rf_eval`. the latter two > functions have a similar performance and using Rcpp is the worst one. Is it > expected

Re: [Rd] Fast way to call an R function from C++?

2019-06-18 Thread King Jiefei
Hello Kevin and Iñaki, Thanks for your quick responses. I sincerely appreciate them! I can see how complicated it is to interact with R in C. Iñaki's suggestion is very helpful, I saw there is a lot of performance gain by turning the flag on, but sadly the best performance it can offer still canno

[Rd] Small bug in fligner.test - constant values can produce significant results (patch attached)

2019-06-18 Thread Karolis Koncevičius
In specific cases fligner.test() can produce a small p-value even when both groups have constant variance. Here is an illustration: fligner.test(c(1,1,2,2), c("a","a","b","b")) # p-value = NA But: fligner.test(c(1,1,1,2,2,2), c("a","a","a","b","b","b")) # p-value < 2.2e-16 This c