Re: [Rd] `@<-` modify its argument when slot is externalptr

2018-03-18 Thread Lukas Stadler
> On 18.03.2018, at 15:54, luke-tier...@uiowa.edu wrote: > > x <- setClass("foo", slots = "bar") > x <- new("foo", bar = 1) > y <- x > y@bar > ## [1] 1 > `@<-`(x, bar, 2) > y@bar > ## [1] 2 > > Will be fixed soon in R-devel. > I always assumed that this behavior is intentional, in order to m

[Rd] formatting raw vectors with names

2017-11-09 Thread Lukas Stadler
I think there’s a bug concerning the formatting of raw vectors with names: > structure(as.raw(1:3), .Names = c("a", "", "c")) a c 01 02 03 > structure(1:3, .Names = c("a", "", "c")) a c 123 The problem is that EncodeRaw does not honor the requested wid

Re: [Rd] Extreme bunching of random values from runif with Mersenne-Twister seed

2017-11-03 Thread Lukas Stadler
If I interpret the original message as “I think there’s something wrong with R's random number generator”: Your assumption is that going from the seed to the first random number is a good hash function, which it isn’t. E.g., with Mersenne Twister it’s a couple of multiplications, bit shifts, xors

[Rd] range function with finite=T and logical parameters

2017-10-23 Thread Lukas Stadler
Hi! I was wondering about the behavior of the range function wrt. logical NAs: > range(c(0L, 1L, NA), finite=T) [1] 0 1 > range(c(F, T, NA), finite=T) [1] NA NA The documentation is quite clear that "finite = TRUE includes na.rm = TRUE”, so that I would have assumed that these two snippets woul

Re: [Rd] calling R API functions after engine shutdown

2017-10-02 Thread Lukas Stadler
ome cases cleanup code that would be put in C++ destructors, if they were > safe with R, can instead be put into R finalizers. > > Tomas > > > > On 09/21/2017 04:41 PM, Lukas Stadler wrote: >> Hi! >> >> We’ve recently come across an example where a packag

[Rd] logic ops with zero-extent raw vectors

2017-09-27 Thread Lukas Stadler
Hi, there was a change concerning logical operations about a year ago: https://github.com/wch/r-source/commit/9e19d3e3dd5f657b5cfefe562bdd7ede2e2b8786 It's related to a discussion on this list: https://hypatia.math.ethz.ch/pipermail/r-devel/2016-September/073068.html

[Rd] calling R API functions after engine shutdown

2017-09-21 Thread Lukas Stadler
Hi! We’ve recently come across an example where a package (minqa) creates an Rcpp Function object in a static variable. This causes R_ReleaseObject to be called by the destructor at a very late point in time - as part of the system exit function: static Function cf("c"); I’m wondering if that

[Rd] loop compilation problem

2017-08-24 Thread Lukas Stadler
Hi! We’ve seen a problem with the compiler in specific cases of matrix updates: > { m <- matrix(1:4, 2) ; z <- 0; for(i in 1) { m[z <- z + 1,z <- z + 1] <- 99; > } ; m } [,1] [,2] [1,]13 [2,]2 99 Here, it modifies element [2,2], which is unexpected. It behaves correct without

[Rd] RIOT 2017

2017-03-31 Thread Lukas Stadler
17 in Brussels on July 5th. RIOT is an excellent venue for deep technical discussions about R implementations, tools, optimizations and extension, and will be very interesting for anyone interested in what’s under the hood of R implementations. Regards, Lukas Stadler (Oracle), Jan Vitek (Northea

Re: [Rd] `[` not recognized as a primitive in certain cases.

2017-03-28 Thread Lukas Stadler
“typeof” is your friend here: > typeof(`[`) [1] "special" > typeof(mc[[1]]) [1] "symbol" > typeof(mc2[[1]]) [1] "special" so mc[[1]] is a symbol, and thus not a primitive. - Lukas > On 28 Mar 2017, at 14:46, Michael Lawrence wrote: > > There is a difference between the symbol and the function

[Rd] NaN behavior of cumsum

2017-01-20 Thread Lukas Stadler
Hi! I noticed that cumsum behaves different than the other cumulative functions wrt. NaN values: > values <- c(1,2,NaN,1) > for ( f in c(cumsum, cumprod, cummin, cummax)) print(f(values)) [1] 1 3 NA NA [1] 1 2 NaN NaN [1] 1 1 NaN NaN [1] 1 2 NaN NaN The reason is that cumsum (in cu

[Rd] .Internal for functions in distn.R

2017-01-03 Thread Lukas Stadler
Hi, the functions in distn.R were converted from .Internal to .External ([1], in 2012), and to .Call ([2], in 2014). They are still listed as .Internal in names.c, although they are not used in that way. Shouldn’t they be removed? There’s quite some simplification to be had, e.g., do_math3 coul

[Rd] integerOneIndex/get1index/... in vector access error messages

2016-10-12 Thread Lukas Stadler
Hi! We noticed that these error messages were changed to include the name of the function that causes them: > { x<-c(1,2); x[[c("a", "b")]] } old: “Error in x[[c("a", "b")]] : attempt to select more than one element” new: “Error in x[[c("a", "b")]] : attempt to select more than one element in ve

[Rd] Evolution of the R native interface

2016-05-27 Thread Lukas Stadler
in mind that should be part of the working group, please let us know. We may not have thought of them yet. Best Regards, Lukas Stadler [1] https://www.r-consortium.org/news/announcement/2016/03/r-consortium-funds-technical-initiatives-community-events-and-training <https://ww

[Rd] formatting of complex matrix

2016-03-19 Thread Lukas Stadler
While working on the printing code, my colleague Zbyněk Šlajchrt noticed that complex matrixes are sometimes misaligned: > { matrix(1i,2,13) } [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i [2,] 0+1i

Re: [Rd] Help with libiconv problem

2016-03-15 Thread Lukas Stadler
> On 15 Mar 2016, at 0:04, Mick Jordan wrote: > > On 3/14/16 1:49 PM, Mick Jordan wrote: >> A couple of my colleagues are having problems building R-3.2.4 on Mac OS X >> El Capitan somehow related to libiconv. I personally don't have any problems >> on either of my Macs. I'm hoping thie make l

Re: [Rd] Regression in strptime

2016-03-15 Thread Lukas Stadler
Hi! Some context for the tests Mick mentioned: Our tests, which are part of the open-source FastR repository, consist of small executable R snippets. While working on FastR, we test regularly by comparing the output generated when running them on FastR and GNUR. Every difference hints at a probl

[Rd] deparse with parentheses for SUBSET

2016-01-04 Thread Lukas Stadler
if (parens) + print2buff(")", d); if (PRIMVAL(SYMVALUE(op)) == 1) print2buff("[", d); else With this applied, the output is more consistent: > substitute(a[1], list(a = quote