[英]how to run bash script from R
我在文件夹c:/ test中存在一个名为test.sh的bash脚本
问题来源:
在r中运行bash的主要原因是,实际上我使用r下载了.nc4文件,我想通过在r中使用gdalinfo
来获得其bandinfo,这在bash中比在r中更容易工作。 这就是为什么我在bash中准备了另一个可以读取这些.nc4文件的脚本。
发布前搜索
我在r`system'中搜索一个函数,但是在设置了我的bash文件退出位置的文件夹的路径之后,我正在R中尝试此命令
x <- "bash test.sh" #my bash file which i want to run in r
system(x, intern = TRUE,ignore.stdout = FALSE, ignore.stderr = FALSE, wait = TRUE, input = NULL, show.output.on.console = TRUE,minimized = FALSE, invisible = TRUE)
但是得到这个错误
Error in system(x, intern = TRUE, ignore.stdout = FALSE, ignore.stderr = FALSE, :
'bash' not found
致谢
非常感谢您解决此问题。 我第一次使用Rstudio。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.