require(plyr) ## get and parse any commandline options/args cmd.args <- commandArgs(trailingOnly=TRUE) ## this assumes trailingOnly in commandArgs() mk.cmd.args.list <- function(args) { if (length(args)>1) { split.list <- strsplit( args[-1], '\\=' ) ## exclude "--args" values <- llply( split.list, '[[', 2 ) names(values) <- laply( split.list, '[[', 1 ) values } else list() ## the possible returns } cmd.args.list <- mk.cmd.args.list(cmd.args)
In reply to Re^3: Passing parameters to R script
by Anonymous Monk
in thread Passing parameters to R script
by j1n3l0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |