Re: [Rd] package check fail on Windows-release only?

2017-11-21 Thread Martin Maechler
> Paul Johnson > on Mon, 20 Nov 2017 14:59:26 -0600 writes: > I mistakenly left a write in "/tmp" in the rockchalk package (version > 1.8.109) that I uploaded last Friday. Kurt H wrote and asked me to fix > today. > While uploading a new one, I became aware of a probl

Re: [Rd] Small performance bug in [.Date

2017-11-21 Thread Martin Maechler
> Hadley Wickham > on Mon, 20 Nov 2017 12:50:24 -0600 writes: > Hi all, > I think there's an unnecessary line in [.Date which has a considerable > impact on performance when subsetting large dates: > x <- Sys.Date() + 1:1e6 > microbenchmark::microbenchmark(x[1])

[Rd] Truncating vectors by reference in C-backend

2017-11-21 Thread mbonsch
Dear all, I want to create a function shrinkVector(x) that takes x and truncates it to the first element without copy. With SETLENGTH and SET_TRUELENGTH, I can achieve that. You can find a reproducible example below. But the memory that was freed is not available for other objects afterwards,

Re: [Rd] Truncating vectors by reference in C-backend

2017-11-21 Thread luke-tierney
DO NOT DO THIS!!! SETLENGTH and SET_TRUELENGTH are NOT part of the API and are for internal use only. Tho proper way to do this is to copy the data you want into a smaller vector and allow the larger one to be garbage collected. [VECSXPs are like all other vectors in that they are contigously al

Re: [Rd] [R-pkg-devel] package check fail on Windows-release only?

2017-11-21 Thread Uwe Ligges
On 21.11.2017 10:15, Martin Maechler wrote: Paul Johnson on Mon, 20 Nov 2017 14:59:26 -0600 writes: > I mistakenly left a write in "/tmp" in the rockchalk package (version > 1.8.109) that I uploaded last Friday. Kurt H wrote and asked me to fix > today. > While uplo

Re: [Rd] Small performance bug in [.Date

2017-11-21 Thread Hadley Wickham
> Yes, at least so it looks in src/main/objects.c > > Also, we had a very similar change a while ago : > > r65926 | luke | 2014-06-12 15:54:38 +0200 (Thu, 12. Jun 2014) | 2 Zeilen > Geänderte Pfade: >M src/library/base/R/

Re: [Rd] str() not displaying names

2017-11-21 Thread Martin Maechler
[This is a "re-post" -- for some reason it never appeared on R-devel] > Etienne Sanchez > on Tue, 14 Nov 2017 19:33:07 +0100 writes: > In some cases, str() does not print the "names" attribute of the object: > > u <- structure(c(5, 6), names = c("a", "b"), color = "blue") > str(u)

[Rd] Are Rprintf and REprintf thread-safe?

2017-11-21 Thread Winston Chang
Is it safe to call Rprintf and REprintf from a background thread? I'm working on a package that makes calls to fprintf(stderr, ...) on a background thread when errors happen, but when I run R CMD check, it says: Compiled code should not call entry points which might terminate R nor write to st

Re: [Rd] Are Rprintf and REprintf thread-safe?

2017-11-21 Thread luke-tierney
On Tue, 21 Nov 2017, Winston Chang wrote: Is it safe to call Rprintf and REprintf from a background thread? I'm working on a package that makes calls to fprintf(stderr, ...) on a background thread when errors happen, but when I run R CMD check, it says: Compiled code should not call entry poin

Re: [Rd] Are Rprintf and REprintf thread-safe?

2017-11-21 Thread Winston Chang
Thanks - I'll find another way to send messages to the main thread for printing. -Winston On Tue, Nov 21, 2017 at 12:42 PM, wrote: > On Tue, 21 Nov 2017, Winston Chang wrote: > >> Is it safe to call Rprintf and REprintf from a background thread? I'm >> working on a package that makes calls to f

Re: [Rd] Are Rprintf and REprintf thread-safe?

2017-11-21 Thread Martin Morgan
On 11/21/2017 04:12 PM, Winston Chang wrote: Thanks - I'll find another way to send messages to the main thread for printing. The CRAN synchronicity and Bioconductor BiocParallel packages provide inter-process locks that you could use to surround writes (instead of sending message to the main

[Rd] `[[<-.data.frame` leaves holes after existing columns and returns a corrupt data frame

2017-11-21 Thread Hervé Pagès
Hi, `[<-.data.frame` is cautious about not leaving holes after existing columns: > `[<-`(data.frame(id=1:6), 3, value=data.frame(V3=11:16)) Error in `[<-.data.frame`(data.frame(id = 1:6), 3, value = data.frame(V3 = 11:16)) : new columns would leave holes after existing columns but `[[

[Rd] `[<-.data.frame` sets rownames incorrectly

2017-11-21 Thread Hervé Pagès
Hi, Here is another problem with data frame subsetting: > df <- data.frame(aa=1:3) > value <- data.frame(aa=11:12, row.names=c("A", "B")) > `[<-`(df, 4:5, , value=value) aa 1 1 2 2 3 3 A 11 B 12 > `[<-`(df, 5:4, , value=value) aa 1 1 2 2 3 3 B 12 A 11

Re: [Rd] `[<-.data.frame` sets rownames incorrectly

2017-11-21 Thread Hervé Pagès
On 11/21/2017 06:19 PM, Hervé Pagès wrote: Hi, Here is another problem with data frame subsetting: > df <- data.frame(aa=1:3) > value <- data.frame(aa=11:12, row.names=c("A", "B")) > `[<-`(df, 4:5, , value=value) aa 1 1 2 2 3 3 A 11 B 12 > `[<-`(df, 5:4, , v