Re: [Rd] ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1

2018-08-31 Thread Henrik Bengtsson
Thanks all for a great discussion. I think we can introduce assertions for length(x) <= 1 (and produce a warning/error if not) without changing the value of these &&/|| expressions. In R 3.4.0, '_R_CHECK_LENGTH_1_CONDITION_=true' was introduced to turn warnings on "the condition has length > 1 an

Re: [Rd] Segfault when performing match on POSIXlt object

2018-08-31 Thread Marco Giuliano
Bug report submitted : https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17459 Thanks! On Fri, Aug 31, 2018 at 6:48 PM Martin Maechler wrote: > > Marco Giuliano > > on Fri, 31 Aug 2018 16:50:56 +0200 writes: > > > Hi Martin, should I file a formal bug report somewhere or >

Re: [Rd] svg ignores cex.axis in R3.5.1 on macOS

2018-08-31 Thread Spencer Graves
On 2018-08-31 14:21, Spencer Graves wrote: Plots produced using svg in R 3.5.1 under macOS 10.13.6 ignores cex.axis=2.  Consider the following: > plot(1:2, cex.axis=2) > svg('svg_ignores_cex.axis.svg') > plot(1:2, cex.axis=2) > dev.off() > sessionInfo() R version 3.5.1 (2018-07-02) Platform

[Rd] Argument 'dim' misspelled in error message

2018-08-31 Thread Hervé Pagès
Hi, The following error message misspells the name of the 'dim' argument: > array(integer(0), dim=integer(0)) Error in array(integer(0), dim = integer(0)) : 'dims' cannot be of length 0 The name of the argument is 'dim' not 'dims': > args(array) function (data = NA, dim = length(da

[Rd] svg ignores cex.axis in R3.5.1 on macOS

2018-08-31 Thread Spencer Graves
  Plots produced using svg in R 3.5.1 under macOS 10.13.6 ignores cex.axis=2.  Consider the following: > plot(1:2, cex.axis=2) > svg('svg_ignores_cex.axis.svg') > plot(1:2, cex.axis=2) > dev.off() > sessionInfo() R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin15.6.0 (64-bit) Runn

Re: [Rd] Segfault when performing match on POSIXlt object

2018-08-31 Thread Martin Maechler
> Marco Giuliano > on Fri, 31 Aug 2018 16:50:56 +0200 writes: > Hi Martin, should I file a formal bug report somewhere or > you've already done it ? No, I haven't, and as I may not address this bug further myself (in the near future), it may be best if you file a formal repo

Re: [Rd] compairing doubles

2018-08-31 Thread Iñaki Ucar
El vie., 31 ago. 2018 a las 17:08, Serguei Sokol () escribió: > > Le 31/08/2018 à 16:25, Mark van der Loo a écrit : > > Ah, my bad, you're right of course. > > > > sum(abs(diff(diff( sort(x) < eps > > > > for some reasonable eps then, would do as a oneliner, or > > > > all(abs(diff(diff(sort(x)

Re: [Rd] compairing doubles

2018-08-31 Thread Marc Schwartz via R-devel
> On Aug 31, 2018, at 9:36 AM, Iñaki Ucar wrote: > > El vie., 31 ago. 2018 a las 15:10, Felix Ernst > () escribió: >> >> Dear all, >> >> I a bit unsure, whether this qualifies as a bug, but it is definitly a >> strange behaviour. That why I wanted to discuss it. >> >> With the following fu

Re: [Rd] Segfault when performing match on POSIXlt object

2018-08-31 Thread Marco Giuliano
Hi Martin, should I file a formal bug report somewhere or you've already done it ? On Fri, Aug 31, 2018 at 4:04 PM Martin Maechler wrote: > > Martin Maechler on Fri, 31 Aug 2018 16:00:07 +0200 writes: > > > Marco Giuliano on Fri, 31 Aug 2018 08:53:02 +0200 writes: > > >> Hi All, I f

Re: [Rd] compairing doubles

2018-08-31 Thread Serguei Sokol
Le 31/08/2018 à 16:25, Mark van der Loo a écrit : Ah, my bad, you're right of course. sum(abs(diff(diff( sort(x) < eps for some reasonable eps then, would do as a oneliner, or all(abs(diff(diff(sort(x < eps) or max(abs(diff(diff(sort(x) < eps Or with only four function calls: di

Re: [Rd] compairing doubles

2018-08-31 Thread Mark van der Loo
Ah, my bad, you're right of course. sum(abs(diff(diff( sort(x) < eps for some reasonable eps then, would do as a oneliner, or all(abs(diff(diff(sort(x < eps) or max(abs(diff(diff(sort(x) < eps -Mark Op vr 31 aug. 2018 om 16:14 schreef Iñaki Ucar : > El vie., 31 ago. 2018 a las

Re: [Rd] compairing doubles

2018-08-31 Thread Iñaki Ucar
El vie., 31 ago. 2018 a las 16:00, Mark van der Loo () escribió: > > how about > > is_evenly_spaced <- function(x,...) all.equal(diff(sort(x)),...) This doesn't work, because 1. all.equal does *not* return FALSE. Use of isTRUE or identical(., TRUE) is required if you want a boolean. 2. all.equal

Re: [Rd] Detecting whether a process exists or not by its PID?

2018-08-31 Thread luke-tierney
On Fri, 31 Aug 2018, Gábor Csárdi wrote: On Fri, Aug 31, 2018 at 3:35 PM Tomas Kalibera wrote: On 08/31/2018 03:13 PM, Gábor Csárdi wrote: On Fri, Aug 31, 2018 at 2:51 PM Tomas Kalibera wrote: [...] kill(sig=0) is specified by POSIX but indeed as you say there is a race condition due to PI

Re: [Rd] Segfault when performing match on POSIXlt object

2018-08-31 Thread Martin Maechler
> Martin Maechler on Fri, 31 Aug 2018 16:00:07 +0200 writes: > Marco Giuliano on Fri, 31 Aug 2018 08:53:02 +0200 writes: >> Hi All, I found a possible unexpected behavior when >> performing match/%in% on POSIXlt objects, e.g. : >> d <- as.POSIXlt('2018-01-01') >> # matc

Re: [Rd] compairing doubles

2018-08-31 Thread Mark van der Loo
Sorry for the second e-mail: this is worth watching: https://www.youtube.com/watch?v=3Bu7QUxzIbA&t=1s It's Martin Maechler's talk at useR!2018. This kind of stuff should be mandatory material for any aspiring programmer/data scientist/statistician. -Mark Op vr 31 aug. 2018 om 16:00 schreef Mar

Re: [Rd] compairing doubles

2018-08-31 Thread Mark van der Loo
how about is_evenly_spaced <- function(x,...) all.equal(diff(sort(x)),...) (use ellipsis to set tolerance if necessary) Op vr 31 aug. 2018 om 15:46 schreef Emil Bode : > Agreed that's it's rounding error, and all.equal would be the way to go. > I wouldn't call it a bug, it's simply part of wor

Re: [Rd] Segfault when performing match on POSIXlt object

2018-08-31 Thread Martin Maechler
> Marco Giuliano > on Fri, 31 Aug 2018 08:53:02 +0200 writes: > Hi All, I found a possible unexpected behavior when > performing match/%in% on POSIXlt objects, e.g. : > d <- as.POSIXlt('2018-01-01') > # match(,) --> segfault match(0,d) > # consequently als

Re: [Rd] compairing doubles

2018-08-31 Thread Iñaki Ucar
FYI, more fun with floats: > 0.1+0.1==0.2 [1] TRUE > 0.1+0.1+0.1+0.1==0.4 [1] TRUE > 0.1+0.1+0.1==0.3 [1] FALSE > 0.1+0.1+0.1==0.1*3 [1] TRUE > 0.3==0.1*3 [1] FALSE ¯\_(ツ)_/¯ But this is not R's fault. See: https://0.30004.com Iñaki El vie., 31 ago. 2018 a las 15:36, Iñaki Ucar ()

Re: [Rd] Detecting whether a process exists or not by its PID?

2018-08-31 Thread Gábor Csárdi
On Fri, Aug 31, 2018 at 3:35 PM Tomas Kalibera wrote: > > On 08/31/2018 03:13 PM, Gábor Csárdi wrote: > > On Fri, Aug 31, 2018 at 2:51 PM Tomas Kalibera > > wrote: > > [...] > >> kill(sig=0) is specified by POSIX but indeed as you say there is a race > >> condition due to PID-reuse. In principl

Re: [Rd] compairing doubles

2018-08-31 Thread Emil Bode
Agreed that's it's rounding error, and all.equal would be the way to go. I wouldn't call it a bug, it's simply part of working with floating point numbers, any language has the same issue. And while we're at it, I think the function can be a lot shorter: .is_continous_evenly_spaced <- function(n)

Re: [Rd] compairing doubles

2018-08-31 Thread Iñaki Ucar
El vie., 31 ago. 2018 a las 15:10, Felix Ernst () escribió: > > Dear all, > > I a bit unsure, whether this qualifies as a bug, but it is definitly a > strange behaviour. That why I wanted to discuss it. > > With the following function, I want to test for evenly space numbers, > starting from anyw

Re: [Rd] Detecting whether a process exists or not by its PID?

2018-08-31 Thread Tomas Kalibera
On 08/31/2018 03:13 PM, Gábor Csárdi wrote: On Fri, Aug 31, 2018 at 2:51 PM Tomas Kalibera wrote: [...] kill(sig=0) is specified by POSIX but indeed as you say there is a race condition due to PID-reuse. In principle, detecting that a worker process is still alive cannot be done correctly outs

Re: [Rd] Detecting whether a process exists or not by its PID?

2018-08-31 Thread Gábor Csárdi
On Fri, Aug 31, 2018 at 2:51 PM Tomas Kalibera wrote: [...] > kill(sig=0) is specified by POSIX but indeed as you say there is a race > condition due to PID-reuse. In principle, detecting that a worker > process is still alive cannot be done correctly outside base R. I am not sure why you think

[Rd] Segfault when performing match on POSIXlt object

2018-08-31 Thread Marco Giuliano
Hi All, I found a possible unexpected behavior when performing match/%in% on POSIXlt objects, e.g. : d <- as.POSIXlt('2018-01-01') # match(,) --> segfault match(0,d) # consequently also this fails : 0 %in% d REPORTED ERROR ON LINUX: *** caught segfault *** address 0x16dc2, cause

[Rd] compairing doubles

2018-08-31 Thread Felix Ernst
Dear all, I a bit unsure, whether this qualifies as a bug, but it is definitly a strange behaviour. That why I wanted to discuss it. With the following function, I want to test for evenly space numbers, starting from anywhere. .is_continous_evenly_spaced <- function(n){ if(length(n) < 2) ret

Re: [Rd] Detecting whether a process exists or not by its PID?

2018-08-31 Thread Tomas Kalibera
On 08/31/2018 01:18 AM, Henrik Bengtsson wrote: Hi, I'd like to test whether a (localhost) PSOCK cluster node is still running or not by its PID, e.g. it may have crashed / core dumped. I'm ok with getting false-positive results due to *another* process with the same PID has since started. kill(s

Re: [Rd] build package with unicode (farsi) strings

2018-08-31 Thread Farid Ch
Thank you all for your valuable insights. The most viable workaround is a modification to the Hadley�s line of code: stringi::stri_escape_unicode(letters_fa) %>% paste0("'",.,"'",collapse=',') %>% paste0('c(',.,')') which then, the output string could be easily copied and pasted without ma

Re: [Rd] ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1

2018-08-31 Thread Emil Bode
On 30/08/2018, 20:15, "R-devel on behalf of Hadley Wickham" wrote: On Thu, Aug 30, 2018 at 10:58 AM Martin Maechler wrote: > > > Joris Meys > > on Thu, 30 Aug 2018 14:48:01 +0200 writes: > > > On Thu, Aug 30, 2018 at 2:09 PM Dénes Tóth > >