You can change the "/" function to have an exception for zero:
"/" <- function(x,y) ifelse(y==0,0,base:::"/"(x,y))
For example:
> 10/0 [1] 0
This is very risky, although, for example, it can break other people's code. If you want to do this, it's probably a good idea to assign a different statement rather than changing / . Also mathematically makes no sense!
Sacha epskamp
source share