如何在R中使用别名运行系统可执行文件? [英] How do I run system executables with aliases within R?

查看:100
本文介绍了如何在R中使用别名运行系统可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我正在R中运行系统命令来运行可执行文件

Suppose, I am running system command in R to run an executable.

inputfile<- /path/myfile.txt

如何用 inputfile 替换以下命令中的 /path/myfile.txt

How can I replace /path/myfile.txt in the below command with inputfile as shown in the command below?

system(可执行-input输入文件-output output.txt)

推荐答案

尝试以下任一方法:

library(gsubfn)

fn$system("executable -input $inputfile  -output output.txt")

或不包含软件包:

cmd <- sprintf("executable -input %s -output output.txt", inputfile)
system(cmd)

这篇关于如何在R中使用别名运行系统可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆