How do I override a non-visible function in the package namespace?

后端 未结 1 1938
暖寄归人
暖寄归人 2020-11-28 07:15

I basically want to change a non-visible function of a package. For visible functions, i.e. functions that have no asterix when methods is called on them, I fou

相关标签:
1条回答
  • 2020-11-28 07:48

    Use fixInNamespace. :)

    fixInNamespace("predict.ar", "stats")
    

    or

    fixInNamespace("predict.ar", pos="package:stats")
    

    (Several years later...)
    From Nicholas H's comment: if you want to push some code to CRAN that depends upon an internal function from another package, it will throw a build warning and be rejected by R-core. If you want that internal function, you should just take a copy of it using the ::: operator and maintain it yourself.

    predict.ar <- stats:::predict.ar
    
    0 讨论(0)
提交回复
热议问题