The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
This vignette explains the hotpatchR design and why
runtime namespace patching is the right tool for legacy hotfix
workflows.
A loaded R package lives in a locked namespace. Internal functions are resolved from inside the package bubble, so calling a hidden helper from the global environment does not change the package’s internal behavior.
This is the namespace trap that makes legacy hotfixing difficult: a visible exported function may still invoke a broken internal helper even after you have sourced a fixed version elsewhere.
The usual workaround is:
That workflow is brittle because a bug in one hidden helper can force you to patch many callers, even when only one implementation needs to change.
Instead of pulling functions out into the global environment,
hotpatchR performs surgical edits inside the package
namespace. That means:
Before using the package, install it from CRAN or GitHub:
install.packages("hotpatchR")
# or, for the development version:
# remotes::install_github("munoztd0/hotpatchR")The package includes a real example of this pattern with an exported parent function and an internal child helper.
library(hotpatchR)
baseline <- dummy_parent_func("test")
print(baseline)
#> [1] "Parent output -> I am the BROKEN child. Input: test"
#> "Parent output -> I am the BROKEN child. Input: test"
inject_patch(
pkg = "hotpatchR",
patch_list = list(
dummy_child_func = function(x) {
paste("I am the FIXED child! Input:", x)
}
)
)
patched_result <- dummy_parent_func("test")
print(patched_result)
#> [1] "Parent output -> I am the FIXED child! Input: test"
#> "Parent output -> I am the FIXED child! Input: test"inject_patch()
Because the replacement function can be defined with the package namespace as its parent, it still has access to the package’s internal helpers.
If you need to restore the original binding,
undo_patch() reverses the previous change.
apply_hotfix_file() is a convenience wrapper for
scripted hotfix application. A compatible hotfix file should define:
pkg (optional, if not passed explicitly)patch_list, a named list of replacement functionsExample hotfix file for this package:
#
pkg <- "hotpatchR"
patch_list <- list(
dummy_child_func = function(x) {
paste("I am the FIXED child! Input:", x)
}
)Then apply it with:
The current package is focused on the core runtime patching path. Future enhancements may include patch comparison, dependency scanning, and CI-friendly test wrappers that explicitly preserve the patched namespace during test execution.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.