简体   繁体   English

包中的R编辑功能

[英]Edit R function within a package

I have the dcemriS4 package, which has some functions I am interested in editing. 我有dcemriS4软件包,该软件包具有一些我感兴趣的编辑功能。

Is there some way to make permanent changes to these functions outside of the R environment? 有什么方法可以在R环境之外对这些功能进行永久更改? I could download the source code directly from sourceforge, and I see the sections that need editing there, but can't find any reference to these functions on my filesystem. 我可以直接从sourceforge下载源代码,并且在那里看到需要编辑的部分,但是在我的文件系统上找不到对这些功能的任何引用。

I see that there is a way to re-define the function within an instance of R, but I am going to be using this package a lot, many times from different bash scripts, so I would prefer to just be able to load the package in R without having to 'temporarily' change the function every time via some kind of extra initialization script.. 我看到有一种方法可以在R的实例中重新定义函数,但是我将在很多不同的bash脚本中多次使用此包,所以我宁愿只能够加载该包在R中无需每次都通过某种额外的初始化脚本来“临时”更改功能。

I ended up forking the repository in git, and creating my own branch. 我最终在git中创建了仓库,并创建了自己的分支。 You can then download the modified branch from Git, uninstall the old package by simply removing the folder where it was installed - use .libPaths() to find its location - and then use install.packages('/path/to/newpackage', repos=NULL) 然后,您可以从Git下载修改后的分支,只需删除旧软件包的安装文件夹即可卸载旧软件包-使用.libPaths()查找其位置-然后使用install.packages('/path/to/newpackage', repos=NULL)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM