William Dunlap
2019-May-16 18:56 UTC
[Rd] print.<strorageMode>() not called when autoprinting
In R-3.6.0 autoprinting was changed so that print methods for the storage modes are not called when there is no explicit class attribute. E.g., % R-3.6.0 --vanilla --quiet> print.function <- function(x, ...) { cat("Function with argument list ");cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) }> f <- function(x, ...) { sum( x * seq_along(x) ) } > ffunction(x, ...) { sum( x * seq_along(x) ) }> print(f)Function with argument list function (x, ...) Previous to R-3.6.0 autoprinting did call such methods % R-3.5.3 --vanilla --quiet> print.function <- function(x, ...) { cat("Function with argument list ");cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) }> f <- function(x, ...) { sum( x * seq_along(x) ) } > fFunction with argument list function (x, ...)> print(f)Function with argument list function (x, ...) Was this intentional? Bill Dunlap TIBCO Software wdunlap tibco.com [[alternative HTML version deleted]]
Abby Spurdle
2019-May-17 22:46 UTC
[Rd] print.<strorageMode>() not called when autoprinting
I don't know the answer to your question. However, here's a side issue that may be relevant. Last year, I tried creating my own ecdf object, and redefined the print method for ecdf. It worked ok in the console, interactively. However, when I tried calling the method (with autoprinting) inside an Sweave document, the stats package method was used instead of my method. I never determined why this was happening. However, R check generated a warning later, so I renamed the classes and methods. Abs On Fri, May 17, 2019 at 6:57 AM William Dunlap via R-devel < r-devel at r-project.org> wrote:> > In R-3.6.0 autoprinting was changed so that print methods for the storage > modes are not called when there is no explicit class attribute. E.g., > > % R-3.6.0 --vanilla --quiet > > print.function <- function(x, ...) { cat("Function with argument list");> cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) } > > f <- function(x, ...) { sum( x * seq_along(x) ) } > > f > function(x, ...) { sum( x * seq_along(x) ) } > > print(f) > Function with argument list function (x, ...) > > Previous to R-3.6.0 autoprinting did call such methods > % R-3.5.3 --vanilla --quiet > > print.function <- function(x, ...) { cat("Function with argument list");> cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) } > > f <- function(x, ...) { sum( x * seq_along(x) ) } > > f > Function with argument list function (x, ...) > > print(f) > Function with argument list function (x, ...) > > Was this intentional? > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel[[alternative HTML version deleted]]
Martin Maechler
2019-May-21 16:28 UTC
[Rd] print.<strorageMode>() not called when autoprinting
>>>>> William Dunlap via R-devel >>>>> on Thu, 16 May 2019 11:56:45 -0700 writes:> In R-3.6.0 autoprinting was changed so that print methods for the storage > modes are not called when there is no explicit class attribute. E.g., > % R-3.6.0 --vanilla --quiet >> print.function <- function(x, ...) { cat("Function with argument list "); > cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) } >> f <- function(x, ...) { sum( x * seq_along(x) ) } >> f > function(x, ...) { sum( x * seq_along(x) ) } >> print(f) > Function with argument list function (x, ...) > Previous to R-3.6.0 autoprinting did call such methods > % R-3.5.3 --vanilla --quiet >> print.function <- function(x, ...) { cat("Function with argument list "); > cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) } >> f <- function(x, ...) { sum( x * seq_along(x) ) } >> f > Function with argument list function (x, ...) >> print(f) > Function with argument list function (x, ...) > Was this intentional? No, it was not. ... and I've been the one committing the wrong change. ... Related to the NEWS entries which start "Changes in print.*() ...." Thank you Bill, for reporting.... It's amazing this has not been detected earlier by anybody. I think it is *only* for functions, not general print.<storagemode>() as you were suggesting - right? Martin
William Dunlap
2019-May-21 17:38 UTC
[Rd] print.<strorageMode>() not called when autoprinting
It also is a problem with storage.modes "integer" and "complex": 3.6.0> print.integer <- function(x,...) "integer vector" 3.6.0> 1:10 [1] 1 2 3 4 5 6 7 8 9 10 3.6.0> print(1:10) [1] "integer vector" 3.6.0> 3.6.0> print.complex <- function(x, ...) "complex vector" 3.6.0> 1+2i [1] 1+2i 3.6.0> print(1+2i) [1] "complex vector" Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, May 21, 2019 at 9:31 AM Martin Maechler <maechler at stat.math.ethz.ch> wrote:> >>>>> William Dunlap via R-devel > >>>>> on Thu, 16 May 2019 11:56:45 -0700 writes: > > > In R-3.6.0 autoprinting was changed so that print methods for the > storage > > modes are not called when there is no explicit class attribute. > E.g., > > > % R-3.6.0 --vanilla --quiet > >> print.function <- function(x, ...) { cat("Function with argument > list "); > > cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) } > >> f <- function(x, ...) { sum( x * seq_along(x) ) } > >> f > > function(x, ...) { sum( x * seq_along(x) ) } > >> print(f) > > Function with argument list function (x, ...) > > > Previous to R-3.6.0 autoprinting did call such methods > > % R-3.5.3 --vanilla --quiet > >> print.function <- function(x, ...) { cat("Function with argument > list "); > > cat(sep="\n ", head(deparse(args(x)), -1)); invisible(x) } > >> f <- function(x, ...) { sum( x * seq_along(x) ) } > >> f > > Function with argument list function (x, ...) > >> print(f) > > Function with argument list function (x, ...) > > > Was this intentional? > > No, it was not. ... and I've been the one committing the wrong change. > > ... Related to the NEWS entries which start > > "Changes in print.*() ...." > > Thank you Bill, for reporting.... > > It's amazing this has not been detected earlier by anybody. > > I think it is *only* for functions, not general > print.<storagemode>() as you were suggesting - right? > > Martin >[[alternative HTML version deleted]]
Seemingly Similar Threads
- print.<strorageMode>() not called when autoprinting
- print.<strorageMode>() not called when autoprinting
- print.<strorageMode>() not called when autoprinting
- print.<strorageMode>() not called when autoprinting
- print.<strorageMode>() not called when autoprinting