[Rd] defining a print method

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 05 Jan 2006 - 04:47:20 GMT


In the following session we define an xx class and a print method for it. If I invoke it with print then it prints as expected but if we just type xx at the R prompt then we get nothing back. How do we define the print method so that it works in the latter case too?

> xx <- structure("abc", class = "xx")
> print.xx <- function(x, ...) shQuote(x)
> print(xx) # ok

[1] "\"abc\""
> xx # no output ????
>
> sessionInfo()

R version 2.2.1, 2005-12-20, i386-pc-mingw32

attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets" [7] "base"
>



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Jan 05 15:53:59 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:35 GMT