#get R arguments from the command line #Get aruments from the command line argv <- commandArgs(TRUE) # Check if the command line is not empty and convert values to numerical values if (length(argv) > 0){ nSim <- as.numeric( argv[1] ) val <- as.numeric( argv[2] ) outFile <- argv[3] } message(paste("First argument:",nSim )) message(paste("Second argument:", val )) message(paste("Third argument:", outFile )) # create a 2 by 5 matrix x <- matrix(1:10, ncol = 5) write(x, file=outFile, sep="\t")