[Rd] sink(con, type = "message"): what is the reason why 'message' sinks cannot be stacked?

2018-03-20 Thread Henrik Bengtsson
In ?sink we can read:

  "Sink-ing the messages stream should be done only with great care.
For that stream file must be an already open connection, and there is
no stack of connections."

and:

  "Do not sink the messages stream unless you understand the source
code implementing it and hence the pitfalls."

Does anyone know the background/reason for this?  Is it a design
decision, or is it just that it was complicated/is not-yet
implemented?  If the latter, I could add it to my to-do list looking
into how stacked message sinks could be supported.


Because of the limitation of only active "message" sink, it is more or
less impossible to reliably capture stderr in package code, or at
least not unconditionally, e.g.

if (sink.number("message") - 2L == 0) {
  sink(con, type = "message")
  ...
} else {
  # Do something else not relying on 'message' sinks
}

Any code/package that does not acknowledge the above, will hijack any
existing message sink.

/Henrik

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] WISH: Sys.setlocale() to return value invisibly

2018-03-20 Thread Henrik Bengtsson
Contrary to, say, Sys.setenv(), Sys.setlocale() returns it's value
visibly.  This means that if you for instance add:

Sys.setlocale("LC_COLLATE", "C")

to your .Rprofile file, it will print:

[1] "C"

at startup. The workaround is to wrap the call in invisible(), but I'd
argue that any "setter" function should return invisibly.

Some more details:

> withVisible(Sys.setlocale("LC_COLLATE", "C"))
$value
[1] "C"

$visible
[1] TRUE

> withVisible(Sys.setenv(FOO = "C"))
$value
[1] TRUE

$visible
[1] FALSE

/Henrik

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] R 3.5.0 scheduled for April 23

2018-03-20 Thread Peter Dalgaard via R-devel
Full schedule available on developer.r-project.org (pending auto-update from 
SVN)

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] trivial typo in man/pretty.Rd

2018-03-20 Thread Martin Maechler
> Ben Bolker 
> on Mon, 19 Mar 2018 11:57:34 -0400 writes:

> patch against recent SVN ...
> as far as I can tell this trivial typo has been there for 20 years:

> 
https://github.com/wch/r-source/blame/ba7920a99fb2fb62b89e404e65f8b132ed4c150a/src/library/base/man/pretty.Rd

indeed, 20 years and 2 weeks today:  then it's good to fix it
finally.

Thank you Ben!
Martin

> ===
> --- pretty.Rd (revision 74426)
> +++ pretty.Rd (working copy)
> @@ -21,8 +21,8 @@
> \item{min.n}{nonnegative integer giving the \emph{minimal} number of
> intervals.  If \code{min.n == 0}, \code{pretty(.)} may return a
> single value.}
> -  \item{shrink.sml}{positive numeric
> -by a which a default scale is shrunk in the case when
> +  \item{shrink.sml}{positive numeric factor
> +by which a default scale is shrunk in the case when
> \code{range(x)} is very small (usually 0).}
> \item{high.u.bias}{non-negative numeric, typically \eqn{> 1}.
> The interval unit is determined as \{1,2,5,10\} times \code{b}, a

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel