Rev 54485 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
## accumulate here tests of the relation between S4 and S3 classes## $<-.data.frame did stupid things with the class attribute## that clobbered S4 classes extending "data.frame"## Test that the S4 method (R 2.13.0) works transparentlyset.seed(864)xx <- data.frame(a=rnorm(10),b=as.factor(sample(c("T", "F"), 10, TRUE)),row.names = paste("R",1:10,sep=":"))setClass("myData", representation(extra = "character"),contains = "data.frame")mx <- new("myData", xx, extra = "testing")## three kinds of $<-: replace, add, delete (NULL value)mx$a <- mx$a * 2xx$a <- xx$a * 2mx$c <- 1:10xx$c <- 1:10mx$b <- NULLxx$b <- NULLstopifnot(identical(mx, new("myData", xx, extra = "testing")))