Running R Code from Command Line (Windows)

前端 未结 4 924
南笙
南笙 2020-12-02 17:41

I have some R code inside a file called analyse.r. I would like to be able to, from the command line (CMD), run the code in that file without having to pass through the R te

4条回答
  •  庸人自扰
    2020-12-02 17:47

    1. You want Rscript.exe.

    2. You can control the output from within the script -- see sink() and its documentation.

    3. You can access command-arguments via commandArgs().

    4. You can control command-line arguments more finely via the getopt and optparse packages.

    5. If everything else fails, consider reading the manuals or contributed documentation

提交回复
热议问题