Displaying 2 results from an estimated 2 matches for "myclassb".
Did you mean:
myclass
2010 Jul 21
1
Bug: broken exception handling in S4 methods
..."numeric"),
function(x)
{
new("MyClassA", x)
}
)
## OK
er = try({ MyClassA(c(1,2)) })
## OK (error in constructor)
er = try({ MyClassA(c(1,2)) })
## OK (error evaluating argument to a function)
er = try({ sin(MyClassA(c(1,2))) })
# Now consider we define MyClassB that has MyClassA in a slot
# and we define a constructor that takes such objects:
setClassUnion("MyClassAOrNULL", c("MyClassA", "NULL"))
setClass("MyClassB",
representation(
ca = "MyClassAOrNULL"
),
prototype(ca = NULL)
)
s...
2011 Apr 05
1
super basic questions about S4 classes
Apologies for asking something that is probably super obvious, i just started
with S4 classes and i guess i am not finding documentation that layout the
grammar rules and give enough examples. Some questions i am having are these
1. I understand that main method of writing a member function is to write a
generic function and setMethod for this particular object. This, however,
presumes that there