Skip to content
Prev 57196 / 63421 Next

Possible bug in `class<-` when a class-specific '[[.' method is defined

On 07/07/2019 11:49 a.m., Ghiggi Gionata wrote:
This is what I see:


 > counttt <- 0
 >
 > `[[.MYCLASS` = function(x, ...) {
+   counttt <<- counttt + 1
+   # browser()
+   x = NextMethod()
+   return(x)
+ }
 >
 > df <- as.data.frame(matrix(1:20, nrow=5))
 > class(df) <- c("MYCLASS","data.frame")
 > counttt
[1] 0

So there's something else going on in your system.  Maybe post 
sessionInfo()?

Duncan Murdoch