# R_argument_pass_test.r ```gherkin=1 # Load arguments and print the script usage information args = commandArgs(trailingOnly=TRUE) cat(" #Rscript --vanilla yourScript.R [arg1] [arg2] [arg3] #arg1: sample table (the column name p_id is neeeded for argument 2) #arg2: project id (must be one of value in the p_id column of the sample table) #arg3: output file path ") # Test if there are three argument: if not, return an error if (length(args)!=3) { stop("Three arguments must be supplied (input).n", call.=FALSE) } # Test the argument is correctly passed into R #print(length(args)) # it should be 3 #print(args[1]) # the first argument #print(args[2]) # the second argument #print(args[3]) # the third argument ``` ###### tags: `R template`