看帖神器
未名空间
追帖动态
头条新闻
每日新帖
最新热帖
新闻存档
热帖存档
文学城
虎扑论坛
未名空间
北美华人网
北美微论坛
看帖神器
登录
← 下载
《看帖神器》官方
iOS App
,体验轻松追帖。
R包开发的时候怎么测试?
查看未名空间今日新帖
最新回复:2021年6月22日 21点57分 PT
共 (6) 楼
返回列表
订阅追帖
只看未读
更多选项
阅读全帖
只看图片
只看视频
查看原帖
w
wdong
3 年多
楼主 (未名空间)
请教一个R开发流程的问题。
比如我有一个R包的源代码,正常使用流程是:
1. 在源代码内用install.packages(pkgs='.', repo=NULL)安装包
2. 在测试程序里用library(...)导入包,或者用::加qualification用包里的内容。
好了,现在假设我要不断修改测试这个包,我不希望我改一行就需要走第1步重新安装
才能测试。有没有什么办法能够直接加载源程序目录中的包,而不需要先安装?
h
huangrh
3 年多
2 楼
可以试一下 source('C:/path/to/file.R')。
另外推荐用Rstudio来写,and if you check the box then
RStudio do source for you when you save a R file.
m
magliner
3 年多
3 楼
我老都是把重要的东西放进函数里,然后‘编译’/run这个函数,修改一行,编译一下,测试一下;不需要和‘包’/package打交道。等把函数写好了,再生成一个包。
不太科学,我是不想和各种包打交道。
c
cb2
3 年多
4 楼
不知道这是不是你要的.
例如
trace(limma:::barcodeplot,edit=TRUE) ## this will open an editor to allow
modifying the function
untrace(limma:::barcodeplot) # stop tracing
g
guanshui
3 年多
5 楼
R package 完整的testing tutorial:
https://r-pkgs.org/tests.html
不谢
g
guanshui
3 年多
6 楼
R package 完整的testing tutorial:
https://r-pkgs.org/tests.html
不谢
请输入帖子链接
收藏帖子
请教一个R开发流程的问题。
比如我有一个R包的源代码,正常使用流程是:
1. 在源代码内用install.packages(pkgs='.', repo=NULL)安装包
2. 在测试程序里用library(...)导入包,或者用::加qualification用包里的内容。
好了,现在假设我要不断修改测试这个包,我不希望我改一行就需要走第1步重新安装
才能测试。有没有什么办法能够直接加载源程序目录中的包,而不需要先安装?
可以试一下 source('C:/path/to/file.R')。
另外推荐用Rstudio来写,and if you check the box then
RStudio do source for you when you save a R file.
我老都是把重要的东西放进函数里,然后‘编译’/run这个函数,修改一行,编译一下,测试一下;不需要和‘包’/package打交道。等把函数写好了,再生成一个包。
不太科学,我是不想和各种包打交道。
不知道这是不是你要的.
例如
trace(limma:::barcodeplot,edit=TRUE) ## this will open an editor to allow
modifying the function
untrace(limma:::barcodeplot) # stop tracing
R package 完整的testing tutorial:https://r-pkgs.org/tests.html
不谢
R package 完整的testing tutorial:
https://r-pkgs.org/tests.html
不谢