问题描述
我正在尝试使用SemiMarkov软件包,并且想要在其中更改一小段代码.我已经通过以下方式进行了挖掘:
I'm trying to use the SemiMarkov package and I want to change one small line of code in there. I've done some digging via:
getAnywhere("semiMarkov")
&我已经确定要更改此行:
& I've identified that I want to change this line:
hessian <- diag(ginv(hessian(V, solution)))
尝试类似的东西:
hessian <- diag(ginv(pracma::hessian(V, solution)))
我该如何处理?我是否需要从头开始重建软件包,如果需要,则需要rTools等,还是有一个简单的解决方法(我是相关的R新手)?我已经做了一些在线搜索,找不到明显的东西.任何想法/指针都表示感谢.
How do I go about this? Do I need to rebuild the package from scratch, and if so do I need rTools etc for this, or is there a simple-ish workaround (I'm a relevant R novice)? I've done some searching online and can't find anything obvious. Any ideas/pointers gratefully appreciated.
推荐答案
Linux环境
从CRAN下载程序包源开始.
Linux environment
Starting with downloading the package source from CRAN.
- 这是登录页面: https://cran.r- project.org/web/packages/SemiMarkov/index.html
- 这是软件包的来源: https://cran. r-project.org/src/contrib/SemiMarkov_1.4.2.tar.gz
- This is the landing page: https://cran.r-project.org/web/packages/SemiMarkov/index.html
- This is the package source: https://cran.r-project.org/src/contrib/SemiMarkov_1.4.2.tar.gz
下载并提取源代码:
wget https://cran.r-project.org/src/contrib/SemiMarkov_1.4.2.tar.gz
tar -xvzf SemiMarkov_1.4.2.tar.gz
这将导致一个名为SemiMarkov
的目录.打开源(cd SemiMarkov
),然后根据需要进行修改.
This should result in a directory named SemiMarkov
. Open up the source (cd SemiMarkov
), and modify as necessary.
接下来,进行更改:
cd ..
R CMD build SemiMarkov/
这将导致一个名为SemiMarkov_1.4.2.tar.gz
的新存档文件.
This will result in a new archive file named SemiMarkov_1.4.2.tar.gz
.
最后,安装修改后的归档文件:
Lastly, install your modified archive:
R CMD INSTALL SemiMarkov_1.4.2.tar.gz
Windows环境
我不太熟悉Windows平台. * Cyxwin中提供了nix工具,但这很痛苦.相反,正如Josh O'Brien指出的那样,您应该遵循.
这篇关于r修改并重建软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!