[R] how to overwrite a Unary operator ?

PO SU rhelpmaillist at 163.com
Fri Oct 17 06:29:45 CEST 2014


Dear expeRts,
  Now i want to know how to implement an Unary operator like  i++ in cpp's  synax form.
  e.g.   2++  will let 2 be 3 ,  a<-2 ,a++ ,will let a be 3
I tried this :
 '%++%'<-function(x){
   x<<-x+1
}
but it have problem, the biggest one is   it seems  the function need two params like   a%++%b , how to write a function needing just one param?

TKS !



--

PO SU
mail: desolator88 at 163.com 
Majored in Statistics from SJTU


More information about the R-help mailing list