Hello,
I would like to overload the + operator so that it can be used to concatenate
two strings, e.g John + Doe = JohnDoe.
How can I 'unseal' the + method?
setMethod(+, signature(e1=character, e2=character), function(e1, e2)
paste(e1, e2, sep=) )
Error in setMethod(+, signature(e1 =
On 11/02/2011 06:52 AM, Albert-Jan Roskam wrote:
Hello,
I would like to overload the + operator so that it can be used to concatenate two strings, e.g
John + Doe = JohnDoe.
How can I 'unseal' the + method?
setMethod(+, signature(e1=character, e2=character), function(e1, e2) paste(e1, e2,
How can I overload the [ and [- operators using S3 classes?
Something like '['.{class} did not work or at least I do not know how to define
it properly.
For S4 it is straightforward:
setMethod([, signature(x = myClass, i = numeric),
function (x, i, j, ..., drop){
...
On Sat, Oct 30, 2010 at 9:03 AM, Mark Heckmann mark.heckm...@gmx.de wrote:
How can I overload the [ and [- operators using S3 classes?
Something like '['.{class} did not work or at least I do not know how to
define it properly.
For S4 it is straightforward:
setMethod([, signature(x =
How can I add a new method to the generic function [ or +
I want to create a S3 and S4 class that will use the [ and + method in a
different way.
How can I overload the generic primitive [ or + so the method dispatch will
work correctly for my class?
I saw an example of this in the ggplot2
On Thu, Oct 28, 2010 at 9:31 AM, Mark Heckmann mark.heckm...@gmx.de wrote:
How can I add a new method to the generic function [ or +
I want to create a S3 and S4 class that will use the [ and + method in a
different way.
How can I overload the generic primitive [ or + so the method dispatch
Dear Barry, this is really interesting. However I could not understand
this line:
Ops.ss=function(e1,e2){paste(e1,e2)}
Where you have told R to behave + function differently when it faces
ss class?
What should be the ideal approach if I what to use * function?
Thanks,
On Thu, Oct 28, 2010 at
On 10/28/2010 02:17 AM, Barry Rowlingson wrote:
On Thu, Oct 28, 2010 at 9:31 AM, Mark Heckmann mark.heckm...@gmx.de wrote:
How can I add a new method to the generic function [ or +
I want to create a S3 and S4 class that will use the [ and + method in a
different way.
How can I overload
On Thu, Oct 28, 2010 at 2:12 PM, Martin Morgan mtmor...@fhcrc.org wrote:
Not so hard, eh? Though then like your S3 implementation this makes all
'Ops' (see ?Ops)
Except you have to re-run the set* things every R session:
setClass(SS, character)
setMethod(Ops, c(SS, SS), function(e1, e2)
On Thu, Oct 28, 2010 at 12:14 PM, Christofer Bogaso
bogaso.christo...@gmail.com wrote:
Dear Barry, this is really interesting. However I could not understand
this line:
Ops.ss=function(e1,e2){paste(e1,e2)}
Where you have told R to behave + function differently when it faces
ss class?
What
Note how S3 methods are dispatched only by reference to the first
argument (on the left of the operator). I think S4 beats this by
having signatures that can dispatch depending on both arguments.
That's somewhat of a simplification for primitive binary operators. R
actually looks up the method
Hello,
I am trying to write an R package for doing analysis of speaker
recognition systems. The big thing in this line of research is a
DET-plot (detection Error Trade-off, a ROC plot with qnorm() warped
axes). My approach has been to make a class det and also a
function det() that will
Perhaps you could just call it Det.
On Mon, Oct 19, 2009 at 7:16 PM, David van Leeuwen
david.vanleeu...@gmail.com wrote:
Hello,
I am trying to write an R package for doing analysis of speaker
recognition systems. The big thing in this line of research is a
DET-plot (detection Error
On Sat, 2009-05-09 at 20:50 +0200, Carlos J. Gil Bellosta wrote:
Hello,
I am building a package that creates a new kind of object not unlike a
dataframe. However, it is not an extension of a dataframe, as the data
themselves reside elsewhere. It only contains metadata.
I would like to be
Hello,
I am building a package that creates a new kind of object not unlike a
dataframe. However, it is not an extension of a dataframe, as the data
themselves reside elsewhere. It only contains metadata.
I would like to be able to retrieve data from my objects such as the
number of rows, the
Hi Shrikanth --
SHRIKANTH SHANKAR shrikanth.shan...@gmail.com writes:
I have been trying to write a new class that reimplements the vector
class. As a test of my overloading I decided to try and and call
t.test on two vectors which were objects of my class rather than the
default class.
I have been trying to write a new class that reimplements the vector
class. As a test of my overloading I decided to try and and call
t.test on two vectors which were objects of my class rather than the
default class.
The overloaded length I wrote seems to work correctly. I used
SpG == Spencer Graves [EMAIL PROTECTED]
on Sun, 16 Mar 2008 19:47:29 -0700 writes:
SpG Dear Martin: This is wonderful. Thank you very much.
SpG It would be a great help if your suggestions
SpG could be added to See Also and Examples for
SpG methods.
?methods has had
Hi,
Is it possible to supply a new method for the %*% operator? I need to
provide a new method for working on variables of a newly defined class,
ad. I've had no problems overloading +, * etc.., using code such as:
+.ad - function(a,b = NULL)
{
# further code here
}
I've tried to do the
Joe Cainey jcainey at gmail.com writes:
Is it possible to supply a new method for the %*% operator?
clipped
I've tried to do the same thing with %*%:
%*%.ad - function(a,b)
{
# further code here
}
However this doesn't work; the new method is never called and the standard
%*%
Thanks, Ken.
1. How can I find S4 methods for a given function given class(es)
of objects? The 'showMethods' function lists available generics for a
given function; showMethods('%*%') just produced for me a list of 52
different signatures for %*%. However, I don't know how to find
Spencer Graves wrote:
Thanks, Ken.
1. How can I find S4 methods for a given function given class(es)
of objects? The 'showMethods' function lists available generics for a
given function; showMethods('%*%') just produced for me a list of 52
different signatures for %*%.
Dear Martin:
This is wonderful. Thank you very much.
It would be a great help if your suggestions could be added to
See Also and Examples for methods.
Thanks again,
Spencer Graves
Martin Morgan wrote:
Spencer Graves wrote:
Thanks, Ken.
1. How can I
23 matches
Mail list logo