[Rd] package load altering RNG state

2017-02-07 Thread Benjamin Tyner
Hello When loading a package, I'm wondering if it's frowned upon for the package to alter the state of the random number generator? I guess not, since the parallel package does it? > set.seed(6860) > old.seed <- .GlobalEnv$.Random.seed > library(parallel) > new.seed <- .GlobalEnv$

[Rd] buggy ANSI escape sequences in R prompt

2017-02-07 Thread Hugo Raguet
When R is run interactively in a terminal which supports colors, it is possible to use ANSI escape sequences in order to put colors in the prompt, such as options(prompt = "\033[0;31mThis is red\033[0m> ") Unfortunately, something goes wrong because for long command lines, the line continuation o

Re: [Rd] package load altering RNG state

2017-02-07 Thread Henric Winell
Hi, On 2017-02-07 13:12, Benjamin Tyner wrote: Hello When loading a package, I'm wondering if it's frowned upon for the package to alter the state of the random number generator? I guess not, since the parallel package does it? Surprisingly it is not frowned upon, but it *is* a nuisance.

Re: [Rd] buggy ANSI escape sequences in R prompt

2017-02-07 Thread Gábor Csárdi
I guess that R does not know about ANSI sequences, and it calculates the width of the prompt including the characters in the sequences. You cannot do much about this, except maybe use a prompt that has two lines. You can put the colored text and whatever you like in the first line, and the second l

Re: [Rd] buggy ANSI escape sequences in R prompt

2017-02-07 Thread Hugo Raguet
Thanks for the hint. I agree with your analysis, but that still would not explain why the continuation overrides the begining of the same line instead of going to the next line. I think I'll go for the two-lines prompt. If you have a Stack Overflow account, you can post your answer and I will accep

Re: [Rd] package load altering RNG state

2017-02-07 Thread Martin Maechler
> Henric Winell > on Tue, 7 Feb 2017 13:37:42 +0100 writes: > Hi, On 2017-02-07 13:12, Benjamin Tyner wrote: >> Hello >> >> When loading a package, I'm wondering if it's frowned >> upon for the package to alter the state of the random >> number generator? I g

Re: [Rd] package load altering RNG state

2017-02-07 Thread Henric Winell
On 2017-02-07 15:59, Martin Maechler wrote: Henric Winell on Tue, 7 Feb 2017 13:37:42 +0100 writes: > Hi, On 2017-02-07 13:12, Benjamin Tyner wrote: >> Hello >> >> When loading a package, I'm wondering if it's frowned >> upon for the package to alter the state o

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-02-07 Thread Suharto Anggono Suharto Anggono via R-devel
Function 'tapply' in R devel r72137 uses if(!is.null(ans) && is.na(default) && is.atomic(ans)) . Problems: - It is possible that user-specified 'default' is not of length 1. If the length is zero, the 'if' gives an error. - It is possible that is.na(default) is TRUE and user-specified 'default' i

Re: [Rd] package load altering RNG state

2017-02-07 Thread Benjamin Tyner
Martin, Outstanding! This is a most welcome enhancement. Regards Ben On 02/07/2017 09:59 AM, Martin Maechler wrote: Henric Winell on Tue, 7 Feb 2017 13:37:42 +0100 writes: > Hi, On 2017-02-07 13:12, Benjamin Tyner wrote: >> Hello >> >> When loading a package, I'm