Skip to content

defining a print method

2 messages · Gabor Grothendieck, Deepayan Sarkar

#
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?
[1] "\"abc\""
R version 2.2.1, 2005-12-20, i386-pc-mingw32

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
[7] "base"
#
On 1/4/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
shQuote doesn't print anything, you probably want

print.xx <- function(x, ...) print(shQuote(x))

-Deepayan