maechler@stat.math.ethz.ch
2000-Jun-30 18:15 UTC
[Rd] dim(a <- ...) sets invisible flag erronously (PR#587)
{Nothing really harmful; R 1.1.0} dim(.) sets (or doesn't clear) the ``invisible flag'' for printing in certain circumstances: > dim(a <- cbind(1)) > does *not* print as it should : > dim(a) [1] 1 1 --- Question to the real "hackers" : How can I check this using R code alone (not using files), i.e. (how) can I ask an R expression if its ``invisible flag'' is set or not ? {help(invisible) doesn't help here}. Maybe one would want an is.invisible(.) function? -- Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <>< -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian Ripley
2000-Jul-10 13:36 UTC
[Rd] dim(a <- ...) sets invisible flag erronously (PR#587)
> Date: Fri, 30 Jun 2000 20:15:51 +0200 (MET DST) > From: maechler@stat.math.ethz.ch > To: r-devel@stat.math.ethz.ch > Subject: [Rd] dim(a <- ...) sets invisible flag erronously (PR#587) > CC: R-bugs@biostat.ku.dk > X-Loop: R-bugs@biostat.ku.dk > > {Nothing really harmful; R 1.1.0} > > dim(.) sets (or doesn't clear) the ``invisible flag'' for printing in > certain circumstances: > > > dim(a <- cbind(1)) > > > > does *not* print as it should : > > > dim(a) > [1] 1 1This is nothing to do with dim: any function will do this.> foo <- function(x) x > foo(a <- cbind(1))It happens because the way invisible is implemented is different in R and S: in S there is a .Auto.print var in frame 1, and in R there is a global variable R_visible, so anything during the evaluation that unsets the flag will ensure that the result is invisible. I don't see how to avoid this without checking the `depth' in the evaluation pretty carefully (and R's semantics differ from those of S in that braced expressions do not generate a frame). Is this worth fixing? print(.Last.value) works all the time, and perhaps you might be persuaded not to write code that uses assignments as arguments?> --- > > Question to the real "hackers" : > > How can I check this using R code alone (not using files), > i.e. (how) can I ask an R expression if its ``invisible flag'' is set or not ? > > {help(invisible) doesn't help here}. > > Maybe one would want an > > is.invisible(.) > > function?There seems to be an unused internal function do_visibleflag in print.c. -- Brian D. Ripley, ripley@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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Apparently Analagous Threads
- R-alpha: "invisible" (yet again): a more problematic bug[let]
- how to determine if a function's result is invisible
- R-alpha: "invisible" : R_INVISIBLE .. -- repeat{} gives BOMB
- Could .Primitive("[") stop forcing R_Visible = TRUE?
- invisible() - does not return immediately as return() does