From: "A.J. Rossini" <[EMAIL PROTECTED]>
You are mixing S3 and S4 paradigms. You want setMethod to define the
method, not the FunctionName.ClassOfObject S3 specification.
That just proves my newbie-ness in R programming. I would appreciate it if
you could provide me the S4 equivalent. According
On 4/21/05, Ali - <[EMAIL PROTECTED]> wrote:
>
>
> >
> >
> >f <- function(...) UseMethod("f", NULL)
> >
> >f.NULL <- function(...) {
> > args <- list(...)
> > classes <- sapply(args, class)
> > .Class <- paste(classes, collapse = ".")
> > NextMethod("f", ...)
> >}
> >
> >f.numeric <- function(..
f <- function(...) UseMethod("f", NULL)
f.NULL <- function(...) {
args <- list(...)
classes <- sapply(args, class)
.Class <- paste(classes, collapse = ".")
NextMethod("f", ...)
}
f.numeric <- function(...) 2 * ..1
f.numeric.numeric <- function(...) ..1 + ..2
f.char
On 4/21/05, Ali - <[EMAIL PROTECTED]> wrote:
>
> >>
> >>- How to overload methods in classes created by R.oo package?
> >[snip]
> >
> >Maybe you missed it in the flurry of messages, but did the idea suggested
> >by Gabor Grothendick not suit your needs?
>
> I had to abstract the question in a set
- How to overload methods in classes created by R.oo package?
[snip]
Maybe you missed it in the flurry of messages, but did the idea suggested
by Gabor Grothendick not suit your needs?
I had to abstract the question in a setntence this time to prevent it to be
missed again 'in the flurry of mess
On Thu, 21 Apr 2005, Henrik Bengtsson wrote:
> > But what is wrong with:
> > setGeneric("testFun", function(object, ...))
> Naming conflicts, may be the problem. You have that generic in your package,
> but I might, without know about yours, and I write
> setGeneric("testFun", function(x, ...))
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Gentry
> Sent: Thursday, April 21, 2005 9:22 PM
> To: Ali -
> Cc: r-devel@stat.math.ethz.ch
> Subject: RE: [Rd] Overloading methods in R
>
>
>
> On Thu, 21 A
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Tony Plate
> Sent: Thursday, April 21, 2005 9:11 PM
> To: Ali -
> Cc: [EMAIL PROTECTED]; r-devel@stat.math.ethz.ch
> Subject: Re: [Rd] Overloading methods in R
>
>
On Thu, 21 Apr 2005, Ali - wrote:
> I guess the context says you cannot have something like this in S4:
> >setGeneric("testFun", function(...)
> + standardGeneric("testFun"))
But what is wrong with:
setGeneric("testFun", function(object, ...))
Keeping in mind that 'object' is the actual instant
Ali - wrote:
Henrik,
[snip]
>
Finally, I remind the package author about the original question:
- How to overload methods in classes created by R.oo package?
[snip]
Maybe you missed it in the flurry of messages, but did the idea
suggested by Gabor Grothendick not suit your needs? I don't know th
On Thu, 21 Apr 2005, Ali - wrote:
> >However, in S3 you can create a "generic" generic function by not
> >specifying
> >arguments but only '...' - this way any methods can take any arguments
(and
> >you don't force your argument names onto other developer's).
> So why did they go a step backward
On Thu, 21 Apr 2005, Ali - wrote:
> >However, in S3 you can create a "generic" generic function by not
> >specifying
> >arguments but only '...' - this way any methods can take any arguments (and
> >you don't force your argument names onto other developer's).
> So why did they go a step backward
On 4/21/05, Ali - <[EMAIL PROTECTED]> wrote:
> Thanks a lot for the reply Henrik.
>
> I do not know what was the motivation of R developers to go for yet another
> OO design, but I wish the designers would have thought of ways to interface
> this design to the other designs.
Depends on which OO d
Thanks a lot for the reply Henrik.
I do not know what was the motivation of R developers to go for yet another
OO design, but I wish the designers would have thought of ways to interface
this design to the other designs.
As a wrapper developer, I like packages like R.oo not because it uses S3,
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ali -
> Sent: Thursday, April 21, 2005 1:28 PM
> To: [EMAIL PROTECTED]
> Cc: r-devel@stat.math.ethz.ch
> Subject: RE: [Rd] Overloading methods in R
>
>
> Henrik,
>
&
some 'answer'.
-Ali
Hi. Some clarification on R.oo:
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of A.J. Rossini
> Sent: Wednesday, April 20, 2005 6:21 PM
> To: Ali -
> Cc: r-devel@stat.math.ethz.ch
> Subject: Re: [R
Hi. Some clarification on R.oo:
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of A.J. Rossini
> Sent: Wednesday, April 20, 2005 6:21 PM
> To: Ali -
> Cc: r-devel@stat.math.ethz.ch
> Subject: Re: [Rd] Overloading methods in R
Hello,
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of A.J. Rossini
> Sent: Wednesday, April 20, 2005 12:21 PM
> To: Ali -
> Cc: r-devel@stat.math.ethz.ch
> Subject: Re: [Rd] Overloading methods in R
>
> R.oo tries to
On 4/20/05, Ali - <[EMAIL PROTECTED]> wrote:
> (1) It seems to me that, generally, in R it is not possible to overload
> functions. Is that right?
>
> (2) Assuming that the above is true, or partially true, is there any extra
> packages to handle overloading in R?
>
> (3) Assuming (1) is TRUE and
> "Ali" == Ali - <[EMAIL PROTECTED]>
> on Wed, 20 Apr 2005 15:45:09 + writes:
Ali> Thanks a lot Tony. I am trying to apply the overloading
Ali> to the methods created by R.oo package and,
Ali> unfortunately, R.oo uses S3-style classes; so I cannot
Ali> use the featu
"Ali -" <[EMAIL PROTECTED]> writes:
> On the other hand, I caouldn't find a decent OO package which is
> based on S4 AND comes with the official release of R.
The OO system that comes with R and is based on S4 *is* S4. The
challenge is that it is a different way of doing OO as compared to
Java.
R.oo tries to implement an old-fashioned OO system as found in Java,
Python, C++, etc. R's S4 methods implement a nice modern system based
on the generic function approach , dispatch on argument signatures,
which is different.
While the R documentation for S4 classes is quite useful (spanning the
Thanks a lot Tony. I am trying to apply the overloading to the methods
created by R.oo package and, unfortunately, R.oo uses S3-style classes; so I
cannot use the features of S4 methods as you described. On the other hand, I
caouldn't find a decent OO package which is based on S4 AND comes with
If I understand what you are looking for, I believe your assumption (1)
is FALSE, not TRUE as you suspected.
One thing to realize is that "methods" in R are very different to those
in other common "object-oriented" languages such as C++, Java, or
Python. One difference is that methods are not
Sean,
Thanks, but, I am actually talking about overloading 'methods' and not
'functions', or you may want to answer this question: How to overload
methods in classes created by R.oo package?
On Apr 20, 2005, at 8:16 AM, Ali - wrote:
(1) It seems to me that, generally, in R it is not possible to
On Apr 20, 2005, at 8:16 AM, Ali - wrote:
(1) It seems to me that, generally, in R it is not possible to
overload functions. Is that right?
(2) Assuming that the above is true, or partially true, is there any
extra packages to handle overloading in R?
(3) Assuming (1) is TRUE and (2) is FALSE
26 matches
Mail list logo