search for: methoddefinition

Displaying 17 results from an estimated 17 matches for "methoddefinition".

2005 Nov 14
1
Tidiest way of modifying S4 classes?
...about making a new method or slot or whatever is sensible in this case. What does one make of this: > getClass(class(kinship:::plot.pedigree)) No Slots, prototype of class "function" Extends: "OptionalFunction", "PossibleMethod" Known Subclasses: Class "MethodDefinition", from data part Class "genericFunction", from data part Class "functionWithTrace", from data part Class "derivedDefaultMethod", by class "MethodDefinition" Class "MethodWithNext", by class "MethodDefinition" Class "SealedMethodD...
2012 Aug 05
2
setMethod sometimes fails to set package slot when signature has trailing 'ANY'
...quot;A", y="A"), function(x, y) {}) setMethod(bar, signature(x="A", y="ANY"), function(x, y) {}) the method for signature c("A", "A") contains package information > str(getMethod(bar, c("A", "A"))) Formal class 'MethodDefinition' [package "methods"] with 4 slots ..@ .Data :function (x, y) ..@ target :Formal class 'signature' [package "methods"] with 3 slots .. .. ..@ .Data : chr [1:2] "A" "A" .. .. ..@ names : chr [1:2] "x" "y" .. .....
2012 Aug 03
1
Interaction between callNextMethod() and selectMethod()
...or another 'callNextMethod'") In addition: Warning message: In if (is.na(i)) { : the condition has length > 1 and only the first element will be used 2 things about this: (1) Sure callNextMethod() needs some context in order to know what to do but it seems that the MethodDefinition object returned by selectMethod() carries that context i.e. it seems to contain all the information that callNextMethod() would need (name of the generic and defined signature) to actually work: > mymethod <- selectMethod("as.matrix", "A") &gt...
2012 Aug 22
1
loading both RPostgreSQL and RSQLite leads to problems
...="classGeneratorFunction" object="classRepresentation" object="dbObjectId" object="envRefClass" object="function" (inherited from: object="ANY") object="genericFunction" object="genericFunctionWithTrace" object="MethodDefinition" object="MethodDefinitionWithTrace" object="MethodSelectionReport" object="MethodWithNext" object="MethodWithNextWithTrace" object="namedList" object="ObjectsWithPackage" object="oldClass" object="PostgreSQLDriver"...
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
...sweep.cols, recalc.after.sweep = recalc.after.sweep, ...) } .local(object, ...) } Desire to be able to access formals() for the .local() function definition, not the generic one. Have seen information desired available via "defined" slot of returned 'MethodDefinition' object, but not using the code below. ==================== library(methods) if (!isGeneric("normalize")) { ## Other packages also define this generic... setGeneric("normalize", function(object, ...) standardGeneric("normalize")) } setC...
2007 Apr 15
0
as() creates invalid entries in methods list?
...as(list(), "A") > get(".MTable", environment(coerce))[["list#A"]] function (from, to) { obj <- new("A") as(obj, "list") <- from obj } <environment: namespace:methods> Entries in .MTable should be MethodDefinition objects (or at least that is what is usually there for methods defined via setAs). It happens that if you try to load a package that has a NAMESPACE file with a directive exportMethods(coerce) but no call to setAs then you get an error: library("hello") Error in .mergeMethodsTable...
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
...sweep.cols, recalc.after.sweep = recalc.after.sweep, ...) } .local(object, ...) } Desire to be able to access formals() for the .local() function definition, not the generic one. Have seen information desired available via "defined" slot of returned 'MethodDefinition' object, but not using the code below. ==================== library(methods) if (!isGeneric("normalize")) { ## Other packages also define this generic... setGeneric("normalize", function(object, ...) standardGeneric("normalize")) } setC...
2003 Jul 26
2
How to make "<-" generic?
...w("A") > b <- new("B") > a <- b > a An object of class "B" Slot "x": numeric(0) > ## should be a ? > ## but selectMethod(...) works correct > selectMethod("<-",c("A","B")) Method Definition (Class "MethodDefinition"): function(x,value) { print("myAssign.default"); return(x); } Signatures: x value target "A" "B" defined "A" "B" What happens with the setReplaceMethod(...) call? My version is platform i686-pc-linux-gnu arch i686 os l...
2010 Mar 08
1
confused by classes and methods.
...statistic@avg = mean(statistic@obs) statistic@current = newData if(length(statistic@obs)==1 || is.na(statistic@beg)){ statistic@beg = newData } return(statistic) } Firstly, I know you can use methods which seems to add some value. I looked at http://developer.r-project.org/methodDefinition.html but I try setMethod("update", signature(statistic="statisticInfo", newData="numeric"), function(statistic, newData){ statistic@obs = c(statistic@obs, newData) statistic@max = max(newData, statistic@max, na.rm=T) statistic@min = min(newData, statistic...
2015 Jan 28
0
[Q] Get formal arguments of my implemented S4 method
...= recalc.after.sweep, > ...) > } > .local(object, ...) > } > > > Desire to be able to access formals() for the .local() function definition, > not the generic one. Have seen information desired available via "defined" > slot of returned 'MethodDefinition' object, but not using the code below. > > > > ==================== > > library(methods) > > if (!isGeneric("normalize")) { > ## Other packages also define this generic... > setGeneric("normalize", > function(object, .....
2004 May 13
0
using trace() on S4 coerce method
...<- new("MyClass1",a=20) > as(x,"MyClass2") An object of class "MyClass2" Slot "a": [1] "20" > tracingState(on=TRUE) [1] FALSE > getMethod("coerce",c("MyClass1","MyClass2")) Method Definition (Class "MethodDefinition"): function (from, to = "MyClass2", strict = TRUE) new(to, a = as.character(from at a)) Signatures: from to target "MyClass1" "MyClass2" defined "MyClass1" "MyClass2" > trace("coerce",browser,signature=c("My...
2015 Jan 29
0
[Q] Get formal arguments of my implemented S4 method
...= recalc.after.sweep, > ...) > } > .local(object, ...) > } > > > Desire to be able to access formals() for the .local() function definition, > not the generic one. Have seen information desired available via "defined" > slot of returned 'MethodDefinition' object, but not using the code below. > > > > ==================== > > library(methods) > > if (!isGeneric("normalize")) { > ## Other packages also define this generic... > setGeneric("normalize", > function(object, .....
2002 Nov 05
1
function showMethods and inheritance
Hi, The following question might come from my (deep) misunderstanding of the concepts in the package 'methods'. I have a class 'A', and a class 'B' inheriting 'A' (so defined with 'setClass' and the parameter 'contains="A"'. The class A has a method 'mymethod'. A call to 'showMethods("mymethod")' return the
2015 Jan 29
3
[Q] Get formal arguments of my implemented S4 method
......) >> } >> .local(object, ...) >> } >> >> >> Desire to be able to access formals() for the .local() function definition, >> not the generic one. Have seen information desired available via "defined" >> slot of returned 'MethodDefinition' object, but not using the code below. >> >> >> >> ==================== >> >> library(methods) >> >> if (!isGeneric("normalize")) { >> ## Other packages also define this generic... >> setGeneric("normalize&quo...
2003 Jun 13
1
Documenting classes and methods: was Re: R-devel Digest, Vol 3, Issue 23
Might it be an idea to make "?" a special operator akin to "+" or "[", R users could then write their own help functions - may be even making "?" generic? With the proposed xml help system one could imagine quite sophisticated context sensitive help systems. Regards, John Marsland PS this has been a very useful debate for those of us enthusiastically
2008 Jul 27
4
Object-oriented programming in R for Java programmers?
Hi, I was wondering if anybody might have a reference for me: My R code is growing and getting more and more confusing. Thus, I figure it's time to switch to object-oriented again. I have done oo programming in C++ and Java before but the first few tutorial on R oo were a bit confusing for me. Is there any brief tutorial on oo programming in R especially for people who have done oo in Java
2002 Jul 11
1
dyn.load tcl/tk (PR#1774)
...latex EmptyMethodsList-class text html latex EnvironmentClass text html latex GenericFunctions text html latex LanguageClasses text html latex LinearMethodsList-class text html latex MethodDefinition-class text html latex MethodSupport text html latex MethodWithNext-class text html latex Methods text html latex MethodsList-class text html latex MethodsList...