R - fix(): edit a function on the fly

26 Aug 2017

edit a function on the fly (during execution - “interactively” - allows to modify the function and get the result with the modified version, NB: does not modify the source code of the function, but modifies the store function)

sqAdd5ThenSqrt <- function(x){
     x1 <- x^2
     x2 <- x1+4
     x3 <- sqrt(x2)
     return(x3)
   }
 
sqAdd5ThenSqrt(0)
 
fix(sqAdd5ThenSqrt)

sqAdd5ThenSqrt(0)

viewed on http://www.rfunction.com

[ R  function  ]