r - Listing explicitly defined methods only (Reference Classes) -
Is there a way to list only those methods of reference category, which clearly Was defined in class definition (such as "System Classes" such as refObjectGenerator
or envRefClass
) unlike those methods obtained?
example & lt; - SetRefClass (class = "example", fields = list), methods = list (testMethodA = function) ("test method A"}, testMethodB = function () {"test method B"}))
< / Pre>You can currently obtain the
$ methods ()
method by calling (see? SetRefClass
):& Gt; Examples $ methods ("[1]" test "," test "," test "," test "," test "," test "," test " Trace "" using untrace "" methods "
What I'm looking for:
& gt; Example $ methods () [1] "testMethodA" "testMethodB"
1) Try it out:
& gt; Dummy & lt; - setRefClass (class = "dummy") & gt; Setdif (example $ methods), dummy $ methods ()) [1] "testmotha" "teststab"
2) This is another approach that seems to be To work here, but you can test it even more:
name (filter (function (x) atri (x, "refClassName") == example $ className, as .list (example $ def @ refMethods)))
Comments
Post a Comment