Meta tags:
Headings (most frequently used words):
call, an, inherited, method, nextmethod, description, usage, arguments, details, value, ambiguous, selection, references, see, also, examples, methods, package, documentation, browse, packages, we, want, your, feedback,
Text of the page (most frequently used words):
the (136), #method (66), class (57), for (45), methods (33), callnextmethod (31), function (28), arguments (25), with (24), call (23), that (20), and (19), classes (19), rnum (19), from (18), generic (18), functions (12), setmethod (12), objects (12), current (12), round (12), next (12), package (10), documentation (10), object (10), argument (10), two (10), numeric (10), inherited (9), can (8), packages (8), selection (8), are (8), other (7), text (7), called (7), this (6), signature (6), definitions (6), create (6), definition (6), ambiguous (6), not (6), more (5), corresponding (5), slots (5), formal (5), group (5), defined (5), setclass (5), use (5), callgeneric (5), examples (5), first (5), see (5), your (4), language (4), find (4), what (4), test (4), basic (4), set (4), names (4), nextmethod (4), methodslist (4), dispatch (4), description (4), digits (4), default (4), usually (4), one (4), result (4), arith (4), both (4), valid (4), but (4), ambiguity (4), calling (4), value (4), effect (4), code (3), note (3), should (3), have (3), show (3), represent (3), representation (3), generate (3), vector (3), new (3), defunct (3), superclasses (3), math (3), math2 (3), contains (3), return (3), plain (3), will (3), equally (3), compare (3), case (3), passed (3), selected (3), typically (3), such (3), has (3), again (3), below (3), which (3), original (3), missing (3), only (3), information (2), embedding (2), copy (2), remove (2), website (2), github (2), support (2), run (2), rdrr (2), home (2), improve (2), page (2), its (2), list (2), used (2), substitutedirect (2), slot (2), all (2), style (2), inheritance (2), explicitly (2), version (2), setgeneric (2), super (2), specific (2), utilities (2), reference (2), managing (2), shell (2), associated (2), non (2), types (2), methodwithnext (2), skeleton (2), file (2), general (2), methods_details (2), deprecated (2), linearmethodslist (2), initialize (2), versions (2), given (2), get (2), source (2), without (2), using (2), results (2), rounded (2), would (2), then (2), calls (2), else (2), unambiguously (2), instead (2), runif (2), illustrate (2), cat (2), now (2), testing (2), cases (2), before (2), explicit (2), uses (2), select (2), modified (2), careful (2), still (2), error (2), these (2), ambiguities (2), they (2), require (2), than (2), place (2), likely (2), arises (2), choice (2), example (2), selecting (2), same (2), there (2), situations (2), even (2), different (2), means (2), actual (2), once (2), any (2), happens (2), per (2), detailed (2), close, customizing, embed, read, snippets, clipboard, add, following, snippet, personal, blog, ian, mutexlabs, com, issue, tracker, tweet, rdrrhq, provide, technical, individual, you, contact, authors, want, feedback, forge, bioconductor, cran, browse, online, submit, extra, info, optional, suggestion, looking, content, looks, wrong, builtin, special, zbasicfunslist, validity, validobject, internally, control, tracing, traceclasses, report, about, testinheritedmethods, structures, structureclasses, envrefclass, stdrefclass, specified, showmethods, setsclass, register, old, setoldclass, save, actions, loading, setloadactions, specify, superclass, setis, setgroupgeneric, union, setclassunion, coercing, setas, kinds, selectsuperclasses, extension, relations, sclassextension, s4groupgeneric, contain, s3part, rmethodutils, construct, prototype, removemethod, fields, treated, oop, refclass, rclassutils, promptmethods, promptclass, objectswithpackage, structure, nonstructure, utility, plus, compatibility, methodutilities, additional, methodsupport, methods_for_s3, methods_for_nongenerics, methoddefinition, localized, based, localrefclass, elements, languageel, unevaluated, languageclasses, check, sealed, issealedmethod, introduction, inheritedslotnames, manage, implicit, implicitgeneric, look, hasarg, name, getpackagename, getmethod, getclass, tools, genericfunctions, genericfunction, fix, saved, previous, fixprevious, findmethods, findclass, evalsource, environment, environmentclass, internal, representing, empty, emptymethodslist, signatures, dotsmethods, creating, line, classrepresentation, including, classname, compute, adjacency, matrix, classestoam, classes_details, combine, columns, rows, cbind2, coerced, certain, cancoerce, data, basicclasses, force, belong, automatically, integer, operate, numbers, always, primitive, arithmetic, anything, full, accuracy, above, chooses, smaller, number, postponing, until, comparisons, similarly, rely, inhertited, vectors, min, seed, 867, simple, str, print, summary, paste, passes, extends, character, work, inheriting, consistently, must, legal, although, here, cause, trycatch, message, rules, behavior, also, chambers, john, 2016, chapman, hall, chapters, extending, references, bad, design, workarounds, reflect, inconsistencies, tree, inheritances, appearing, among, rare, independent, multiple, ruled, out, inherits, directly, mixin, standard, terminology, needed, resolve, reimpose, some, made, fact, possibilities, conceptually, well, formally, logic, application, requires, computation, appropriate, most, situation, binary, operators, through, sort, three, second, comes, third, come, last, exactly, required, defining, fairly, common, when, uniquely, defines, replaced, either, recalling, returned, statement, precisely, follows, were, remember, say, appears, equivalent, sees, evaluated, possible, though, was, consistent, section, particular, modifying, invalid, assigns, assignments, been, did, exist, less, literally, precise, deleted, cached, where, occurred, search, session, combination, selectmethod, details, often, natural, way, included, really, optionally, usage, appear, inside, after, down, browser, docs,
Text of the page (random words):
nextmethod call an inherited method rdrr io find an r package r language docs run r in your browser home r documentation methods nextmethod call an inherited method nextmethod call an inherited method callnextmethod r documentation call an inherited method description a call to callnextmethod can only appear inside a method definition it then results in a call to the first inherited method after the current method with the arguments to the current method passed down to the next method the value of that method call is the value of callnextmethod usage callnextmethod arguments optionally the arguments to the function in its next call but note that the dispatch is as in the detailed description below the arguments have no effect on selecting the next method if no arguments are included in the call to callnextmethod the effect is to call the method with the current arguments see the detailed description for what this really means calling with no arguments is often the natural way to use callnextmethod see the examples details the next method i e the first inherited method is defined to be that method which would have been called if the current method did not exist this is more or less literally what happens the current method to be precise the method with signature given by the defined slot of the method from which callnextmethod is called is deleted from a copy of the methods for the current generic and selectmethod is called to find the next method the result is cached in the method object where the call occurred so the search typically happens only once per session per combination of argument classes the next method is defined from the signature of the current method not from the actual classes of the arguments in particular modifying any of the arguments has no effect on the selection as a result the selected next method can be called with invalid arguments if the calling function assigns objects of a different class before the callnextmethod call be careful of any assignments to such arguments it is possible for the selection of the next method to be ambiguous even though the original set of methods was consistent see the section ambiguous selection the statement that the method is called with the current arguments is more precisely as follows arguments that were missing in the current call are still missing remember that missing is a valid class in a method signature for a formal argument say x that appears in the original call there is a corresponding argument in the next method call equivalent to x x in effect this means that the next method sees the same actual arguments but arguments are evaluated only once value the value returned by the selected method ambiguous selection there are two fairly common situations in which the choice of a next method is ambiguous even when the original set of methods uniquely defines all method selection unambiguously in these situations callnextmethod should be replaced either by a call to a specific function or by recalling the generic with different arguments the most likely situation arises with methods for binary operators typically through one of the group generic functions see the example for class rnum below examples of this sort usually require three methods two for the case that the first or the second argument comes from the class and a third for the case that both arguments come from the class if that last method uses callnextmethod the other two methods are equally valid the ambiguity is exactly the same that required defining the two argument method in the first place in fact the two possibilities are equally valid conceptually as well as formally as in the example below the logic of the application usually requires selecting a computation explicitly or else calling the generic function with modified arguments to select an appropriate method the other likely source of ambiguity arises from a class that inherits directly from more than one other class a mixin in standard terminology if the generic has methods corresponding to both superclasses a method for the current class is again needed to resolve ambiguity using callnextmethod will again reimpose the ambiguity again some explicit choice has to be made in the calling method instead these ambiguities are not the result of bad design but they do require workarounds other ambiguities usually reflect inconsistencies in the tree of inheritances such as a class appearing in more than one place among the superclasses such cases should be rare but with the independent definition of classes in multiple packages they can t be ruled out references chambers john m 2016 extending r chapman hall chapters 9 and 10 see also callgeneric to call the generic function with the current dispatch rules typically for a group generic function methods_details for the general behavior of method dispatch examples callnextmethod used for the math math2 group generic functions a class to automatically round numeric results to d digits rnum setclass rnum slots c d integer contains numeric math functions operate on the rounded numbers return a plain vector the next method will always be the default usually a primitive setmethod math rnum function x callnextmethod round as numeric x x d setmethod math2 rnum function x digits callnextmethod round as numeric x x d digits examples of callnextmethod with two arguments in the signature for arithmetic and one rnum with anything callnextmethod with no arguments round the full accuracy result and return as plain vector setmethod arith c e1 rnum function e1 e2 as numeric round callnextmethod e1 d setmethod arith c e2 rnum function e1 e2 as numeric round callnextmethod e2 d a method for both arguments from rnum would be ambiguous for callnextmethod the two methods above are equally valid the method chooses the smaller number of digits and then calls the generic function postponing the method selection until it s not ambiguous setmethod arith c e1 rnum e2 rnum function e1 e2 if e1 d e2 d callgeneric e1 as numeric e2 else callgeneric as numeric e1 e2 for comparisons callnextmethod with the rounded arguments setmethod compare c e1 rnum function e1 e2 callnextmethod round e1 e1 d round e2 e1 d setmethod compare c e2 rnum function e1 e2 callnextmethod round e1 e2 d round e2 e2 d similarly to the arith case the method for two rnum objects can not unambiguously use callnextmethod instead we rely on the rnum method inhertited from math2 to return plain vectors setmethod compare c e1 rnum e2 rnum function e1 e2 d min e1 d e2 d callgeneric round e1 d round e2 d set seed 867 x1 rnum 10 runif 5 d 1l x2 rnum 10 runif 5 d 2l x1 1 x2 2 x1 x2 simple examples to illustrate callnextmethod with and without arguments b0 setclass b0 slots c s0 numeric and a function to illustrate callnextmethod f function x text default str x print a summary paste text class x setgeneric f setmethod f b0 function x text b0 cat b0 method called with s0 x s0 n callnextmethod b0 b0 s0 1 call f with 2 arguments callnextmethod passes both to the default method f b0 first test call f with 1 argument the default b0 is not passed by callnextmethod f b0 now a class that extends b0 with no methods for f b1 setclass b1 slots c s1 character contains b0 b1 b1 s0 2 s1 testing b1 the two cases work as before by inheriting the b0 method f b1 b1 s1 f b1 b2 setclass b2 contains b1 and a method for b2 that calls with explicit arguments note that the method selection in callnextmethod uses the class of the argument to consistently select the b0 method setmethod f b2 function x text b1 method y b1 s0 x s0 s1 modified x callnextmethod y text b2 b2 s1 testing b2 s0 10 f b2 b2 s1 f b2 be careful the argument passed must be legal for the method selected although the argument here is numeric it s still the b0 method that s called setmethod f b2 function x text b1 method callnextmethod x s0 text now the call will cause an error trycatch f b2 error function e cat e message n methods as force an object to belong to a class basicclasses classes corresponding to basic data types callgeneric call the current generic function from a method cancoerce can an object be coerced to a certain s4 class cbind2 combine two objects by columns or rows classes s4 class documentation classes_details class definitions classestoam compute an adjacency matrix for superclasses of class classname class names including the corresponding package classrepresentation class class objects documentation using and creating on line documentation for classes and dotsmethods the use of in method signatures emptymethodslist class internal class representing empty methods list environmentclass class environment evalsource use function definitions from a source file without findclass find class definitions findmethods description of the methods defined for a generic function fixprevious fix objects saved from r versions previous to 1 8 genericfunction class generic function objects genericfunctions tools for managing generic functions getclass get class definition getmethod get or test for the definition of a method getpackagename the name associated with a given package hasarg look for an argument in the call implicitgeneric manage implicit versions of generic functions inheritedslotnames names of slots inherited from a super class initialize methods methods to initialize new objects from a class introduction basic use of s4 methods and classes is is an object from a class issealedmethod check for a sealed method or class languageclasses classes to represent unevaluated language objects languageel elements of language objects linearmethodslist class class linearmethodslist localrefclass localized objects based on reference classes methoddefinition class classes to represent method definitions methods s4 class documentation methods defunct defunct functions in package methods methods deprecated deprecated functions in package methods methods_details general information on methods methods_for_nongenerics methods for non generic functions in other packages methods_for_s3 methods for s3 and s4 dispatch method skeleton create a skeleton file for a new method methodslist methodslist objects methodslist class class methodslist defunct representation of methods methods package formal methods and classes methodsupport additional support functions for methods methodutilities utility functions for methods and s plus compatibility methodwithnext class class methodwithnext new generate an object from a class nextmethod call an inherited method nonstructure class a non structure s4 class for basic types objectswithpackage class a vector of object names with associated package names promptclass generate a shell for documentation of a formal class promptmethods generate a shell for documentation of formal methods rclassutils utilities for managing class definitions refclass objects with fields treated by reference oop style removemethod remove a method representation construct a representation or a prototype for a class rmethodutils method utilities s3part s4 classes that contain s3 classes s4groupgeneric s4 group generic functions sclassextension class class to represent inheritance extension relations selectsuperclasses super classes of specific kinds of a class setas methods for coercing an object to a class setclass create a class definition setclassunion classes defined as the union of other classes setgeneric create a generic version of a function setgroupgeneric create a group generic version of a function setis specify a superclass explicitly setloadactions set actions for package loading setmethod create and save a method setoldclass register old style s3 classes and inheritance setsclass create a class definition show show an object showmethods show all the methods for the specified function s or class signature class class signature for method definitions slot the slots in an object from a formal class stdrefclass class envrefclass structureclasses classes corresponding to basic structures substitutedirect substitutedirect testinheritedmethods test for and report about selection of inherited methods traceclasses classes used internally to control tracing validobject test the validity of an object zbasicfunslist list of builtin and special functions what can we improve the page or its content looks wrong i can t find what i m looking for i have a suggestion other extra info optional submit improve this page r package documentation rdrr io home r language documentation run r code online browse r packages cran packages bioconductor packages r forge packages github packages we want your feedback note that we can t provide technical support on individual packages you should contact the package authors for that tweet to rdrrhq github issue tracker ian mutexlabs com personal blog embedding an r snippet on your website add the following code to your website remove this copy to clipboard for more information on customizing the embed code read embedding snippets close
|