如何在 R 中 运行 具有别名的系统可执行文件?
How do I run system executables with aliases within R?
假设,我在 R 中 运行ning 系统命令 运行 一个 executable
。
inputfile <- "/path/myfile.txt"
如何将下面命令中的 /path/myfile.txt
替换为 inputfile
,如下面的命令所示?
system ("executable -input inputfile -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 中 运行ning 系统命令 运行 一个 executable
。
inputfile <- "/path/myfile.txt"
如何将下面命令中的 /path/myfile.txt
替换为 inputfile
,如下面的命令所示?
system ("executable -input inputfile -output output.txt")
尝试以下任一方法:
library(gsubfn)
fn$system("executable -input $inputfile -output output.txt")
或没有包裹:
cmd <- sprintf("executable -input %s -output output.txt", inputfile)
system(cmd)