How do I run system executables with aliases within R?

前端 未结 1 880
不知归路
不知归路 2021-01-28 07:20

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

inputfile <- \"/path/myfile.txt\"

How can I replace /path/myf

1条回答
  •  一向
    一向 (楼主)
    2021-01-28 08:06

    Try either of these:

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

    or without packages:

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

    0 讨论(0)
提交回复
热议问题