Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the commands for R language to execute scripts?

Shulou Source: shulou.com Published: 2022-06-03 02:26:45 10月05日 Update

This article mainly introduces the commands of R language to execute the script, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to know it.

Environment variables should be added before R CMD BATCH and Rscript are used.

Add C:\ Program Files\ R\ R Murray 3.3.0\ bin; to the beginning of the Path value of the system variable

You can use R CMD BATCH * .r

You can also use Rscript * .r args0 args1, which can follow a certain parameter.

Of course, you can also enter the R interactive environment > source ("* .r")

The first command applies to Windows and Mac

The second command applies to Linux

The third command applies, but not with command line arguments

If there is a function in the R script and there are parameters in the function, you can use args (function) to view the parameters of the function.

> paramValue source ("myRfile.R")

There is a parameter in myRfile.R that teaches paramValue, so you can assign a value to paramValue first, and then source R script

Reference: http://r.789695.n4.nabble.com/Command-line-arguments-with-source-Windows-OS-td874573.html

Rscript-e can directly execute expressions in the R language, as follows:

Thank you for reading this article carefully. I hope the article "what are the commands for executing scripts in R language" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Commands parameters scripts articles languages functions variables environment references values interests at the same time more friends knowledge systems ribbons industries expressions information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Apple Huawei MariaDB