How to edit and debug R library sources

前端 未结 3 1679
时光取名叫无心
时光取名叫无心 2020-11-29 02:51

I\'ve included a library called blotter in my R script which has a bug in it. Is there an easy way for me to edit the source to try and debug the issue?

3条回答
  •  旧时难觅i
    2020-11-29 03:34

    Look up the trace and browser functions, they are the basic tools in R for debugging. Say you want to edit the source of function foo, then saying

    trace("foo",edit=TRUE)
    

    will open up the source of foo in the editor for you to change. However, this is for interactive debugging; the source files in the packages are not changed. So once you have found the bug, you need to change the package source files for the change to be permanent.

提交回复
热议问题