Re: [Rd] Unexpected behavior with inheritance and using S3 classes as slots in S4 class

2021-01-28 Thread Ezra Tucker
Wow - can't believe it was that simple (and obvious now that I see the answer). Thanks Simon! -Ezra -- e...@landtucker.com m: 818-203-0269 LinkedIn: linkedin.com/in/ezztucker Github: github.com/minimenchmuncher ‐‐‐ Original Message ‐‐‐ On Thursday, January 28th, 2021 at 8:41 AM, Simon

Re: [Rd] Unexpected behavior with inheritance and using S3 classes as slots in S4 class

2021-01-28 Thread Simon Urbanek
Ezra, I think it's just the fact the you specified the wrong class inheritance in setOldClass() - it has to match you S3 definition, so it should be: setOldClass(c("b","a")) In which case it works: > n(s1 = b_1) An object of class "n" Slot "s1": [1] "world" attr(,"class") [1] "b" "a" Cheers,

[Rd] Unexpected behavior with inheritance and using S3 classes as slots in S4 class

2021-01-27 Thread Ezra Tucker
Hi all, I have a situation where I'm trying to use S3 classes as slots in an S4 class and am running into some problems with inheritance. My example: ## with S3 classes a <- function(x) structure(x, class = "a") b <- function(x) structure(x, class = c("b", "a")) setOldClass(c("a", "b")) a_1 <-