How to modify unexported object in a package

旧时模样 提交于 2019-11-28 13:42:16

As it turns out, I only had to remove the unlockBinding, assign and lockBinding calls.

bar <- function(x) x + 1
assignInNamespace("C_rf", bar, ns="stats", pos="package:stats")

stats:::C_rf
# function(x) x + 1

rf(3, 2, 2)
#Error in .Call(C_rf, n, df1, df2) : 
#  first argument must be a string (of length 1) or native symbol reference
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!