[R] How to define new operator in R?

2011-03-30 Thread Chuanlong Du
Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R means the sum of the two operand on its left and right. I want to define some operators in R by myself. Is this possible? Regards! -- Chuanlong Du Department of Statistcis Iowa

Re: [R] How to define new operator in R?

2011-03-30 Thread David Winsemius
On Mar 30, 2011, at 11:04 AM, Chuanlong Du wrote: Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R means the sum of the two operand on its left and right. I want to define some operators in R by myself. Is this possible?

Re: [R] How to define new operator in R?

2011-03-30 Thread Henrique Dallazuanna
Try this: `%a%` - function(x, y)paste(x, y, sep = ',') 2 %a% 3 On Wed, Mar 30, 2011 at 1:04 PM, Chuanlong Du dcl...@iastate.edu wrote: Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R means the sum of the two operand on its

Re: [R] How to define new operator in R?

2011-03-30 Thread baptiste auguie
Hi, Also, try this and rm() it immediately, `+` - function(x, y) x - y 1+1 rm(`+`) 1+1 baptiste On 31 March 2011 05:04, Chuanlong Du dcl...@iastate.edu wrote: Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R means the sum of

Re: [R] How to define new operator in R?

2011-03-30 Thread Spencer Graves
'+' is a generic function, so different methods can be defined for different classes of objects. Consider the following: methods('+') [1] +.Date +.POSIXt # Methods defined for 'Date' and 'POSIXt' objects args('+.Date') # standard argument names are e1 and e2 function (e1, e2) NULL

Re: [R] How to define new operator in R?

2011-03-30 Thread Frank Schwidom
Hi, you may overwrite existing opreators in the current environment for example: `+` - `*` 2+3 [1] 6 Regards! On Wed, Mar 30, 2011 at 10:04:19AM -0600, Chuanlong Du wrote: Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R