如何在本地R包中修改功能? [英] How to modify a function in local R package?

查看:462
本文介绍了如何在本地R包中修改功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个别人制作的R包.我想为其添加其他功能,该怎么做?

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

推荐答案

要从给定包中更改功能,您可能需要trace函数,它可以帮助您编辑和修改函数F

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.

这篇关于如何在本地R包中修改功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆