Modify or Patch any Function Programmatically
Patch functions programmatically in a robust way so that the patch will work even if there is a change (up to an extent) in the target function. The changes are additive. The changes can be reverted back to the original (within a single session of the package).
You can install the development version from GitHub with:
# You need {remotes} for that (I think you already have that)
# install.packages("remotes")
remotes::install_github("r-rudra/patch")
Just try out following:
library(patch)
help("patch_function")
# possibly you'll be interested in
# source(system.file("embedded","usecases.R",package = "patch"))
# but read warnings before it :-)