Skip to content

do.call() mangles expressions in arguments (PR#174)

3 messages · Peter Dalgaard, Ross Ihaka

#
expression(print("Oops"))
[1] "Oops"

Something in the do_docall code causes an extra eval of the
argument. Causes trouble with math expressions in labels in 
boxplot (do.call("title",...))

--please do not edit the information below--

Version:
 platform = i586-unknown-linux
 arch = i586
 os = linux
 system = i586, linux
 status = Patched (unreleased snapshot)
 status.rev = 0
 major = 0
 minor = 64.0
 year = 1999
 month = April
 day = 22
 language = R

Search Path:
 .GlobalEnv, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Wed, 21 Apr 1999 pd@biostat.ku.dk wrote:

            
I think this is correct behavior.  The function "list" evaluates its
arguments and when it does the "expression" call gets evaluated.

I think that it is boxplot that needs to be fixed.  There needs to be some
form of quoting for the title (and xlab, ylab arguments).  It isn't
completely obvious to me what the right solution is.  It may require a
redesign of boxplot and bxp.

	Ross

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Ross Ihaka <ihaka@stat.auckland.ac.nz> writes:
Oh yes! (D**n! I know I decided to take it easy for a few days, but I
seem to have displaced my brain in the process.)
Hmm. The following seems to work for the xlabs problem at least:

    for (i in 1:length(pars)) pars[[i]] <- as.call(c(as.name("expression"), 
        pars[[i]]))
    if (plot) {
        bxp(groups, width, varwidth = varwidth, notch = notch,
    ...etc...

(one might want to guard that assignment by an if(is.expression())
thing)