[R] How to define new operator in R?

Henrique Dallazuanna wwwhsd at gmail.com
Wed Mar 30 21:34:39 CEST 2011


Try this:

`%a%` <- function(x, y)paste(x, y, sep = ',')
 2 %a% 3


On Wed, Mar 30, 2011 at 1:04 PM, Chuanlong Du <dclong at 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 left and
> right. I want to define some operators in R by myself. Is this possible?
>
> Regards!
>
> --
> Chuanlong Du
> Department of Statistcis
> Iowa State University
> Ames, IA, US 50011
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list