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