How to modify a function in local R package? [clos

2019-06-14 20:27发布

问题:

I have an R package made by someone else. I want to add an additional function to it, how can I do that?

回答1:

To change a function from a given package, you'll probably need trace function, it helps you edit and modify a function F

trace("F",edit=TRUE)

it will open a small window for you to modify the code, but it won't change the actual source code permanently. you can copy and paste the code and create a new function with your own modifications.