This function substitute all old_names
with new_names
in a function
body, and drops all the attributes.
Usage
sub_fn_body_name(fn, old_name, new_name)
Arguments
- fn
Function.
- old_name
Character. Name that needs to be replaced.
- new_name
Character. Replacement of the old name.
Examples
a <- function() self$x + self$y
a
#> function() self$x + self$y
#> <environment: 0x126170c18>
sub_fn_body_name(a, "self", "this")
#> function ()
#> this$x + this$y
#> <environment: 0x126170c18>