Displaying 20 results from an estimated 200000 matches similar to: "What is the group generic mean?"
2003 Feb 20
2
Who to decide what a generic function should look like?
I am not sure if what I am asking below should be discussed under r-help
or r-devel, so please feel free to move over to r-devel.
This is a spin off from Gordon Smyth's question about generic functions
and Robert Gentleman's reply. I have tried to raise the question before
and I am sure this has been discussed by others, but never on the r-help
list what I can see. My concern is that
2003 Feb 20
2
Who to decide what a generic function should look like?
I am not sure if what I am asking below should be discussed under r-help
or r-devel, so please feel free to move over to r-devel.
This is a spin off from Gordon Smyth's question about generic functions
and Robert Gentleman's reply. I have tried to raise the question before
and I am sure this has been discussed by others, but never on the r-help
list what I can see. My concern is that
2018 Aug 09
0
WishList: Remove Generic Arguments
On 09/08/2018 5:45 PM, Abs Spurdle wrote:
> I apologize if this issue has been raised before.
>
> I really like object oriented S3 programming.
> However, there's one feature of object oriented S3 programming that I don't
> like.
> Generic functions can have arguments other than dots.
>
> Lets say you have an R package with something like:
>
>
2018 Aug 09
3
WishList: Remove Generic Arguments
I apologize if this issue has been raised before.
I really like object oriented S3 programming.
However, there's one feature of object oriented S3 programming that I don't
like.
Generic functions can have arguments other than dots.
Lets say you have an R package with something like:
print.myfunction (f, ...)
{ dosomething (f, ...)
}
Noting that I use function objects a lot.
R CMD
2009 May 13
2
Object and Classes ?
I found a tutorial for creating classes using generic functions ? S3
way ! It was short description so I couldn't grok in full its
usage ... So far so good, what i currently do is something like this :
Blah <- function(data,...) UseMethod('Blah')
Blah.default <- function( ...... ) {
self = ....
class(self) <- 'Blah'
self
}
Blah.some_method <-
2019 Mar 27
0
Discrepancy between is.list() and is(x, "list")
Abs et al,
Ok, so I have just gone and re-read the docs again. My language was a more
absolute than it should have been; *however*, I was still correct for the
cases under discussion.
From ?UseMethod (emphasis mine)
An R object is a data object which has a ?class? attribute (and
this can be tested by ?is.object?). A class attribute is a
character vector giving the names of the
2011 Oct 18
1
avoid s3 methods
Hello everybody.
My issue arise when I build a package with my functions. This package is for
personal purposes only and it will not submitted to CRAN.
Anyway, this may be an opportunity for myself to clear the S3 methods
concept. I read the R manual and some books about R programming but they are
usually S4 oriented.
I call a function plot.days(). When I check the package I obtain some
2010 Jun 13
1
S4 classes and S3 generic functions
A general goal for the next version of R is to make S4 and S3 play
better together.
As mentioned in a previous thread, one limitation has been that S3
generic functions, specifically the UseMethod() call, did not make use
of S4 inheritance when dispatching on general S4 objects.
This has been fixed in a version committed today (updated to rev 52267).
The code change is not large, but it
2013 Jul 31
2
S3 internal and group generics
Hi all,
I've noticed a couple of small bugs/documentation errors related to S3
internal and group generics:
* In ?S3groupGeneric, log2 and log10 are not listed as group generics,
even though they are in the equivalent S4 groups, and are the source
code for do_log1arg contains DispatchGroup("Math", ...)
* As well as log2 and log10, tools:::.get_internal_S3_generics() fails
to
2006 Jan 05
1
Generic Functions
Hi,
I've been using the package "graph" in the BioConductor assortment and
writing some functions based on its classes. My question is not specific to
this package or BioConductor (I think), but it serves as a useful example.
I recently wanted to look at the code for the function "edgeMatrix" for the
class "graphNEL".
Usually I would type
> func.foo
and
2010 May 14
1
Creating an S3 method when the generic function is defined in another (imported) package
Hi,
In one of my packages (maxLik), I would like to add an S3 method,
where the generic function (estfun) is defined in another package
(sandwich). Everything works fine if my package "Depends" on the other
package and I import the generic function "estfun" from the "sandwich"
package and define the new method in the NAMESPACE file. However, I
prefer not to load the
Could generic functions check different S3 methods for an object when one of them produces an error?
2019 Jun 18
0
Could generic functions check different S3 methods for an object when one of them produces an error?
Dear Iago,
The R S3 object system works as expected here, using the first available method processing the class vector from left to right. The problem is that the broom package doesn't export the confint.geeglm() method but rather reserves it for internal use. I can't think why the package authors chose to do that but you could ask them. The following therefore works (following on with
2009 Jul 29
1
RFC: methods() and showMethods() {was "debug"}
(a new thread, on purpose)
>>>>> "RobG" == Robert Gentleman <rgentlem at fhcrc.org>
>>>>> on Mon, 27 Jul 2009 16:55:50 -0700 writes:
RobG> Hi, I just committed a change to R-devel so that if
RobG> debug is called on an S3 generic function, all methods
RobG> will also automatically have debug turned on for them
RobG>
2019 Mar 27
2
Discrepancy between is.list() and is(x, "list")
> you had seemed to be presenting it as something new in 3.5.3. I would be
surprised if the behavior doesn't go all the way back to whenever
head.function was added.
My bad.
I'm just surprised I've never noticed these problems before.
> S3 classes have no formal definitions at all
> I'm not sure what is clear about that, or what class hierarchy you're
talking about
2009 Mar 11
1
Could you please add "time<-" as a generic function in the 'stats' package ?
Dear R developers,
As you might have noticed, recent changes in R-dev will not allow the
definition of S3 methods with S4 classes.
But until now, we have defined "time<-" in our 'timeSeries' package as
an S3 generic because other packages are using the same function.
Indeed, if we had defined it as an S4 generic, the other packages
would not coexist well with ours.
2014 Jul 06
2
Depot for S3 to S4 generics (as in stats4)?
Dear developers,
the implementation of S4 generics for existing S3 ones in the base
package is concerned to be a threat to quick startup times [1]. But
since S4 is promoted, and S3/S4 interoperability a pain when package
developing [2], are there efforts to improve the situation? E.g. an S3
free system, etc.
A good thing [2] is the package 'stats4', including some setGeneric
calls (e.g.
Could generic functions check different S3 methods for an object when one of them produces an error?
2019 Jun 17
1
Could generic functions check different S3 methods for an object when one of them produces an error?
Hi,
Let's say one has an object with multiple classes, and a generic function to apply to it has associated S3 methods for more than one of those classes. Further, the method it chooses (I do not know how; some order in the class vector?) is not the suitable one and it produces an error. Would there be some way to make the generic function to choice the correct method, or in case that for
2012 Dec 08
1
namespace S3 and S4 generic imports cannot both be satisfied:
PkgA wishes to write a method for 'unique' on S4 class 'A'. ?Methods indicates
that one should
setGeneric("unique")
setClass("A")
unique.A <- function(x, incomparables=FALSE, ...) {}
setMethod(unique, "A", unique.A)
Both S3 and S4 methods need to be exported in the NAMESPACE
import(methods)
S3method(unique, A)
2005 Apr 21
3
Objects in R
Hi,
A few comments from a fairly experienced R user who
worked for several years on a R-based bioinformatics
analysis framework.
I don't want to misrepresent anyone's views, but...
There are real disadvantages to the
"objects-as-C-structs" and functions/methods which
"mutate" based on argument type. i.e. S4.
(1)Novices simply don't understand it.
2012 Nov 21
1
S3 generic/method consistency issue with R CMD check
Hi,
I'm having some trouble setting methods for the qr family of functions. I
believe I have distilled my misunderstanding in the code snippet below:
foo <- function(x, ...) UseMethod("foo")
foo.default <- function(x) { }
# foo
setGeneric(name = "foo", useAsDefault = foo)
setMethod("foo", signature(x="bar"),
function(x, ...) { }
)