windows command line with command language R

Original Reference: http://tecdat.cn/?p=4525

 

In many cases, we need to call in an external environment software to perform a script directly, without the need to enter the interactive interface software, so are called non-interactive mode, you can quickly and easily execute script statements output reached this way the purpose of results. r software is no exception, there are many ways external calls, one of which is called Batch Processing of the method, and transfer the result by running the script CMD windows or linux out is output to another file. Exemplified below.

First, the advanced settings configured in the system environment variables r

path=D:\R-3.3.0\bin;

Add the directory where the file path in r.exe

Then call the script statement by cmd, format the two platforms are:

# on Linux

RCMD BATCH [options] my_.R [outfile]

# on Microsoft Windows (adjust the path to R.exe as needed)

"C:\Program Files\R\R-2.13.1\bin\R.exe" CMD BATCH

--vanilla --slave "c:\my projects\my_.R"

Open a command line interface in windows

Enter the command

"C:\Program Files\R\R-2.13.1\bin\R.exe" CMD BATCH

--vanilla --slave "c:\my projects\my_.R"

Wherein "C: \ Program Files \ R \ R-2.13.1 \ bin \ R.exe" directory software is r

"C: \ my projects \ my_.R" directory of the executable file

After the run, cmd will be transferred to the output file directory out

It is noteworthy that, out of all the output file will record data that appears in the lower console

And it will record the file execution time

Comparative output interface statements rstudio

r interaction of output relative noteworthy points:

1. R output looks like a run interactively.

2. The output parameter in a few more.

3. Finally, there is a running summary displays the time it takes to run the script.

On the other hand, when the script is not working properly, it will also output out cause of the error report

So for the daily operation of the site, the use of this approach not only convenient, and can record the output process and run summary, you can log reports as log files to use.

Have questions please leave a message below!

Big Data tribe  - Chinese professional third-party data service providers to provide customized one-stop data mining and statistical analysis consultancy services

Statistical analysis and data mining consulting services: y0.cn/teradat (Consulting Services, please contact the official website customer service )

Click here to send me a messageQQ:3025393450

[Service] Scene  

Research; the company outsourcing; online and offline one training; data collection; academic research; report writing; market research.

[Tribe] big data to provide customized one-stop data mining and statistical analysis consultancy

Welcome to elective our R language data analysis will be mining will know the course!

Guess you like

Origin www.cnblogs.com/tecdat/p/11289909.html