Run the R-script from the command line and save the results in a subdirectory

I want to run R-script from the command line (on a Linux machine) and save the results in a subdirectory of the working directory. It looks like this:

./myscript.r [param 1] [param 2] [param 3]

Given 3 binomial parameters, a total of 4 conditions. I want to save the results of each condition in a subdirectory of the working directory.

Is there an elegant way to do this, or do I really need to copy my R-script into each subdirectory?

+2
source share
1 answer

Purcell, try saving and running this script on your computer. Provide it with several different kinds and combinations of arguments.

#!/usr/bin/Rscript
args <- commandArgs(TRUE)
print(args)
class(args)

For example, I started ./test.R test=1 one=test.

paste0() , , .

+1

Source: https://habr.com/ru/post/1668836/


All Articles