前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >批量运行多个R脚本代码

批量运行多个R脚本代码

作者头像
生信菜鸟团
发布2023-11-07 15:48:57
2000
发布2023-11-07 15:48:57
举报
文章被收录于专栏:生信菜鸟团生信菜鸟团

今天,我们利用健明老师推荐的批量运行多个R脚本代码,见证一下该代码的优势。首先,下载《Preoperative immune landscape predisposes adverse outcomes in hepatocellular carcinoma patients with liver transplantation》的 GitHub (https://github.com/sangho1130/KOR_HCC) ,我们发现其共包含19个R脚本。然后,我们一个一个打开脚本检查了一下其所用到的R包,下载好所要用到的所有R包。但是在下载R包过程中我们发现RGtk2和rsgcc这两个包一直报错,没有解决掉这个问题。所以,我们把包含这两个包的5个脚本剔除,把剩下的14个R脚本进行批量运行。

#这两个R包下载失败了,如果你们下载成功了,也欢迎分享以下方法!

具体运行过程

#对以下14个包进行批量运行:

代码语言:javascript
复制
setwd("C:\\Users\\Lenovo\\Desktop\\KOR_HCC-main\\KOR_HCC-main\\code")

fs=list.files('./',pattern = '*.R$')
fs
lapply(fs, function(x){
  print(x)
  source(x)
}) 
代码语言:javascript
复制

#正常运行结果
[1] "Figure_1A.R"
Coordinate system already present. Adding new coordinate system, which will replace the existing one.
[1] "Figure_1B.R"
[1] "Figure_1C_bottom.R"
[1] "Figure_1C_top.R"
Coordinate system already present. Adding new coordinate system, which will replace the existing one.
[1] "Figure_2A.R"
Using Status as id variables
Saving 6.92 x 6.92 in image
Using Status as id variables
Saving 6.92 x 6.92 in image
[1] "Figure_2B.R"
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
[1] "Figure_2D.R"
[1] "Figure_3.R"
[1] "Figure_3_new.R"
[1] "Figure_4A.R"
i SHA-1 hash of file is "015fc0457e61e3e93a903e69a24d96d2dac7b9fb"
The following `from` values were not present in `x`: Yes
[1] "Figure_4B.R"
[1] "Figure_4D.R"
[1] 0.0002906699
[1] "Figure_6A.R"

Barnard's Unconditional Test

           Treatment I Treatment II
Outcome I           10           11
Outcome II           2           11

Null hypothesis: Treatments have no effect on the outcomes
Score statistic = -1.91134
Nuisance parameter = 0.074 (One sided), 0.353 (Two sided)
P-value = 0.0440743 (One sided), 0.0645337 (Two sided)

[1] "Figure_6B.R"

最终,我们就可以得到所有的结果文件:

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2023-11-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 生信菜鸟团 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档