Re: [Rd] ALTREP wrappers and factors

2019-07-18 Thread King Jiefei
Hi Kylie, For your question, I don't think a wrapper can completely solve your problem. The duplication occurs since your variable y has more than 1 reference number( Please see highlighted), so even you have a wrapper, any changes on the value of the wrapper still can trigger the duplication. >

Re: [Rd] strange increase in the reference number

2019-07-15 Thread King Jiefei
#x27;t reveal what was going on, at least to me) and I don't > have the time to dig super deeply into this right now, but perhaps Luke or > Tomas know why this is happening of the top of their head. > > Sorry I can't be of more help. > > ~G > > > > On Fri, Ju

[Rd] strange increase in the reference number

2019-07-12 Thread King Jiefei
Hi, I just found a strange increase in the reference number and I'm wondering if there is any reason for it, here is the code. > a=c(1,2,3) > .Internal(inspect(a)) @0x1bf0b9b0 14 REALSXP g0c3 [NAM(1)] (len=3, tl=0) 1,2,3 > is.vector(a) [1] TRUE > .Internal(inspect(a)) @0x1bf0b9b0

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

2019-06-18 Thread King Jiefei
t2, expr, evn)) >user system elapsed > 2.307 0.000 2.313 > > system.time(test(C_test3, testFunc, evn$x)) >user system elapsed > 2.131 0.000 2.138 > > Iñaki > > On Tue, 18 Jun 2019 at 20:35, Iñaki Ucar wrote: > > > > On Tue, 18 Jun 2019

[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] "if" function in pure R?

2019-05-26 Thread King Jiefei
Hi Alexandre, I'm not an R expert so this is only my personal thought: I don't think you can achieve what you want exactly. A possible solution would be defining a binary operator %*%, where you can replace the asterisk with any function name you want. The function %*% is special since it has two