An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20080507/f5effd32/attachment.pl>
R-2.8.0 : get platform device with get(getOption("device"))
9 messages · Frédéric Lafitte, Brian Ripley, Peter Dalgaard +1 more
Please do study the posting guide. This was covered recently: https://stat.ethz.ch/pipermail/r-devel/2008-April/049319.html
On Wed, 7 May 2008, Fr?d?ric Lafitte wrote:
Hi, I have a R-package that works fine with R 2.7.0 (it builds, checks and installs) but not with R 2.8.0.
There is no 'R 2.8.0' and will not be for some months. You probably mean R-devel, but your code has been erroneous since R 2.5.0.
Running check in 2.8.0 gives the following output : [...] * checking examples ... ERROR [...] The error most likely occurred in: [...]
dev <- show.pr(mr.tbl, col="green", type="b")
Error in get(getOption("device")) : invalid first argument
Calls: show.pr -> get
Execution halted
How can I change this code so that it works fine with R 2.8.0?
Thanks!
[[alternative HTML version deleted]]
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Fr?d?ric Lafitte wrote:
Hi, I have a R-package that works fine with R 2.7.0 (it builds, checks and installs) but not with R 2.8.0. Running check in 2.8.0 gives the following output : [...] * checking examples ... ERROR [...] The error most likely occurred in: [...]
dev <- show.pr(mr.tbl, col="green", type="b")
Error in get(getOption("device")) : invalid first argument
Calls: show.pr -> get
Execution halted
How can I change this code so that it works fine with R 2.8.0?
Use dev.new() instead of that construct.
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Prof Brian Ripley wrote:
Please do study the posting guide. This was covered recently: https://stat.ethz.ch/pipermail/r-devel/2008-April/049319.html
Nevertheless, perhaps an explicit NEWS entry could be warranted,
something like
o The "device" option can now be a function, and is one in some
standard setups. Consequentially, get(getOption("device")) will fail;
programmers should usually use dev.new() instead.
On Wed, 7 May 2008, Fr?d?ric Lafitte wrote:
Hi, I have a R-package that works fine with R 2.7.0 (it builds, checks and installs) but not with R 2.8.0.
There is no 'R 2.8.0' and will not be for some months. You probably mean R-devel, but your code has been erroneous since R 2.5.0.
Running check in 2.8.0 gives the following output : [...] * checking examples ... ERROR [...] The error most likely occurred in: [...]
dev <- show.pr(mr.tbl, col="green", type="b")
Error in get(getOption("device")) : invalid first argument
Calls: show.pr -> get
Execution halted
How can I change this code so that it works fine with R 2.8.0?
Thanks!
[[alternative HTML version deleted]]
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
------------------------------------------------------------------------
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Here is the NEWS item, for 2.5.0
o options(device = ) now accepts a function object as well as
the name of a function.
The construct in the subject line has been broken ever since.
On Thu, 8 May 2008, Peter Dalgaard wrote:
Prof Brian Ripley wrote:
Please do study the posting guide. This was covered recently: https://stat.ethz.ch/pipermail/r-devel/2008-April/049319.html
Nevertheless, perhaps an explicit NEWS entry could be warranted, something
like
o The "device" option can now be a function, and is one in some standard
setups. Consequentially, get(getOption("device")) will fail; programmers
should usually use dev.new() instead.
On Wed, 7 May 2008, Fr?d?ric Lafitte wrote:
Hi, I have a R-package that works fine with R 2.7.0 (it builds, checks and installs) but not with R 2.8.0.
There is no 'R 2.8.0' and will not be for some months. You probably mean R-devel, but your code has been erroneous since R 2.5.0.
Running check in 2.8.0 gives the following output : [...] * checking examples ... ERROR [...] The error most likely occurred in: [...]
dev <- show.pr(mr.tbl, col="green", type="b")
Error in get(getOption("device")) : invalid first argument
Calls: show.pr -> get
Execution halted
How can I change this code so that it works fine with R 2.8.0?
Thanks!
[[alternative HTML version deleted]]
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
------------------------------------------------------------------------
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Prof Brian Ripley wrote:
Here is the NEWS item, for 2.5.0
o options(device = ) now accepts a function object as well as
the name of a function.
The construct in the subject line has been broken ever since.
OK, but that entry was obviously hard to spot even when looking for it!
On Thu, 8 May 2008, Peter Dalgaard wrote:
Prof Brian Ripley wrote:
Please do study the posting guide. This was covered recently: https://stat.ethz.ch/pipermail/r-devel/2008-April/049319.html
Nevertheless, perhaps an explicit NEWS entry could be warranted,
something like
o The "device" option can now be a function, and is one in some
standard setups. Consequentially, get(getOption("device")) will fail;
programmers should usually use dev.new() instead.
So...
o The "device" option now is a function in some standard setups.
Consequentially, get(getOption("device")) will fail; programmers should
usually use dev.new() instead. (Assuming that the device is a character
string has been incorrect since 2.5.0.)
On Wed, 7 May 2008, Fr?d?ric Lafitte wrote:
Hi, I have a R-package that works fine with R 2.7.0 (it builds, checks and installs) but not with R 2.8.0.
There is no 'R 2.8.0' and will not be for some months. You probably mean R-devel, but your code has been erroneous since R 2.5.0.
Running check in 2.8.0 gives the following output : [...] * checking examples ... ERROR [...] The error most likely occurred in: [...]
dev <- show.pr(mr.tbl, col="green", type="b")
Error in get(getOption("device")) : invalid first argument
Calls: show.pr -> get
Execution halted
How can I change this code so that it works fine with R 2.8.0?
Thanks!
[[alternative HTML version deleted]]
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
------------------------------------------------------------------------
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
On Thu, 8 May 2008, Peter Dalgaard wrote:
Prof Brian Ripley wrote:
Here is the NEWS item, for 2.5.0
o options(device = ) now accepts a function object as well as
the name of a function.
The construct in the subject line has been broken ever since.
Yet the change produced no warnings when made, so apparently everyone else missed it!
OK, but that entry was obviously hard to spot even when looking for it!
On Thu, 8 May 2008, Peter Dalgaard wrote:
Prof Brian Ripley wrote:
Please do study the posting guide. This was covered recently: https://stat.ethz.ch/pipermail/r-devel/2008-April/049319.html
Nevertheless, perhaps an explicit NEWS entry could be warranted,
something like
o The "device" option can now be a function, and is one in some
standard setups. Consequentially, get(getOption("device")) will fail;
programmers should usually use dev.new() instead.
So...
o The "device" option now is a function in some standard setups.
Consequentially, get(getOption("device")) will fail; programmers should
usually use dev.new() instead. (Assuming that the device is a character
string has been incorrect since 2.5.0.)
Prof Brian Ripley noted [in another recent message] that it was also wrong to assume ANY arguments for dev.new method. If we are only concerned with interactive screen devices (i.e., x11, windows, quartz), would it be safe to come up with a method that can take basic dimension arguments (width & height)? Suggestions for an R-Core approved method of doing so? We use this functionality every day for creating multiple onscreen windows with specified dimensions. While I understand things have to change to evolve the codebase, this change broke the code supporting countless papers and analyses here in our department, without warning until now. ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
If you set, say options(device="pdf") you get the old behaviour. You really cannot assume that session settings will be unchanged unless you set them yourself.
On Fri, 9 May 2008, Paul Roebuck wrote:
On Thu, 8 May 2008, Peter Dalgaard wrote:
Prof Brian Ripley wrote:
Here is the NEWS item, for 2.5.0
o options(device = ) now accepts a function object as well as
the name of a function.
The construct in the subject line has been broken ever since.
Yet the change produced no warnings when made, so apparently everyone else missed it!
It did, if you set that option.
OK, but that entry was obviously hard to spot even when looking for it!
On Thu, 8 May 2008, Peter Dalgaard wrote:
Prof Brian Ripley wrote:
Please do study the posting guide. This was covered recently: https://stat.ethz.ch/pipermail/r-devel/2008-April/049319.html
Nevertheless, perhaps an explicit NEWS entry could be warranted,
something like
o The "device" option can now be a function, and is one in some
standard setups. Consequentially, get(getOption("device")) will fail;
programmers should usually use dev.new() instead.
So...
o The "device" option now is a function in some standard setups.
Consequentially, get(getOption("device")) will fail; programmers should
usually use dev.new() instead. (Assuming that the device is a character
string has been incorrect since 2.5.0.)
Prof Brian Ripley noted [in another recent message] that it was also wrong to assume ANY arguments for dev.new method. If we are only concerned with interactive screen devices (i.e., x11, windows, quartz), would it be safe to come up with a method that can take basic dimension arguments (width & height)? Suggestions for an R-Core approved method of doing so? We use this functionality every day for creating multiple onscreen windows with specified dimensions. While I understand things have to change to evolve the codebase, this change broke the code supporting countless papers and analyses here in our department, without warning until now. ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
21 days later
On Fri, 9 May 2008, Paul Roebuck wrote:
On Thu, 8 May 2008, Peter Dalgaard wrote:
[SNIP Ripley conversation]
o The "device" option now is a function in some standard setups.
Consequentially, get(getOption("device")) will fail; programmers should
usually use dev.new() instead. (Assuming that the device is a character
string has been incorrect since 2.5.0.)
Prof Brian Ripley noted [in another recent message] that it was also wrong to assume ANY arguments for dev.new method. If we are only concerned with interactive screen devices (i.e., x11, windows, quartz), would it be safe to come up with a method that can take basic dimension arguments (width & height)? Suggestions for an R-Core approved method of doing so? We use this functionality every day for creating multiple onscreen windows with specified dimensions.
Prof. Ripley replied to original note but not to my main
concern. Are there problems with this alternate approach
to creating new interactive devices (R-2.8+)?
Comments/Suggestions appreciated.
##----------------------------------------------------------
## Create new interactive device. Arguments must be named.
intdev.new <- function(...) {
dev <- getOption("device")
if (is.character(dev)) {
if (exists(dev, .GlobalEnv))
dev <- get(dev, .GlobalEnv)
else if (exists(dev, asNamespace("grDevices")))
dev <- get(dev, asNamespace("grDevices"))
else {
stop(gettextf("device '%s' not found", dev),
domain = NA)
}
}
if (!is.function(dev)) {
stop("invalid setting for 'getOption(\"device\")'")
} else if (!dev.interactive(TRUE)) {
stop("device must be interactive")
}
arglist <- as.list(formals(dev))
extras <- match.call(expand.dots=FALSE)$...
if (length(extras) > 0) {
matched <- !is.na(match(names(extras), names(arglist)))
for (a in names(extras)[matched]) {
arglist[[a]] <- extras[[a]]
extras[[a]] <- NULL
}
if (length(extras) > 0) {
stop(sprintf("unnamed argument(s) not allowed: %s",
paste(extras, collapse=", ")))
}
if (any(!matched)) {
warning(sprintf("arguments ignored: %s",
paste(names(extras[!matched]),
collapse=", ")))
}
}
do.call(dev, arglist)
}
## Create interactive device using common arguments
R> intdev.new(width=5, height=5, title="Test")
TIA
----------------------------------------------------------
SIGSIG -- signature too long (core dumped)