[Rd] problem with print.generic(x)deparse(substitute(x))

Spencer Graves spencer.graves at prodsyse.com
Mon Jan 9 10:53:20 CET 2017


Hi, All:


       I'm having trouble getting deparse(substitute(x)) inside 
print.generic to consistently


       I'm having trouble getting a print.something to work 
consistently.  Consider the following toy example:


# Define an object of class 'dum'
k <- 1
class(k) <- 'dum'
str(k) # as expected

# Define print.dum
print.dum <- function(x, ...)
   deparse(substitute(x))

print(k) # Prints "k" as expected
#####**** THE FOLLOWING PRINTS NOTHING:
k # Why?


### Thanks,
### Spencer Graves

sessionInfo()

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils
[5] datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.3.2



More information about the R-devel mailing list