getopt and commandArgs examples, and AF/OR update to use getopt()

This commit is contained in:
Tanushree Tunstall 2020-06-18 17:59:28 +01:00
parent 864f814e1b
commit f9a8ed3dc7
3 changed files with 66 additions and 21 deletions

14
scripts/getopt-example.r Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env Rscript
require('getopt', quietly=TRUE)
spec = matrix(c(
"drug" , "d", 1, "character",
"gene" , "g", 1, "character"
), byrow=TRUE, ncol=4)
opt = getopt(spec);
drug = opt$drug
gene = opt$gene
cat(c('\nDrug:', drug, '\nGene:', gene, '\n'))