Re: [R] Operator Overloading in R

2019-01-16 Thread Eric Berger
I have experience with R6 classes but I have not used operator overloading with them. Out of curiosity I did a quick search and found this link which provides a step by step (I am not claiming it is the only way) https://stackoverflow.com/questions/49463235/arithmetic-operators-overload-for-r6class

Re: [R] Operator overloading for custom classes

2010-03-23 Thread Chidambaram Annamalai
Thanks! On Wed, Mar 24, 2010 at 1:01 AM, Sharpie wrote: > > > Chidambaram Annamalai wrote: > > > > Hi, > > > > I need some help to get some of the object orientation, specifically the > > methods that overload the basic arithmetic operations, from sample C++ > > code to R. I don't have experien

Re: [R] Operator overloading for custom classes

2010-03-23 Thread Sharpie
Chidambaram Annamalai wrote: > > Hi, > > I need some help to get some of the object orientation, specifically the > methods that overload the basic arithmetic operations, from sample C++ > code to R. I don't have experience with such advanced language features > inside of R. So I was wondering

Re: [R] Operator overloading

2008-07-10 Thread Spencer Graves
The 'polynom' package provides one example of how to do this. However, getAnywhere("+.polynomial") just told me "no object named ‘+.polynomial’ was found"; I don't know why. The documentation says it uses S3 classes. The 'Matrix' package should provide other examples, using S4 classes.

Re: [R] Operator overloading

2008-07-10 Thread Peter Dalgaard
hadley wickham wrote: > On Thu, Jul 10, 2008 at 5:09 AM, Peter Dalgaard > <[EMAIL PROTECTED]> wrote: > >> Tine wrote: >> >>> Hi! >>> >>> I was just wondering is there anyway to overload operator for custom >>> class. >>> For example: >>> I have two matrices A and B with same dimensions. I w

Re: [R] Operator overloading

2008-07-10 Thread hadley wickham
On Thu, Jul 10, 2008 at 5:09 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Tine wrote: >> Hi! >> >> I was just wondering is there anyway to overload operator for custom >> class. >> For example: >> I have two matrices A and B with same dimensions. I want to overload >> operator '+' with my own fu

Re: [R] Operator overloading

2008-07-10 Thread Peter Dalgaard
Tine wrote: > Hi! > > I was just wondering is there anyway to overload operator for custom > class. > For example: > I have two matrices A and B with same dimensions. I want to overload > operator '+' with my own function. > Or even better can I create my own (new) operator. > Example: > A+-B where