2020-07-06 R命令行参数解析

#!/psd/biosoft/anaconda/envs/CNEr/bin/Rscript

suppressMessages(library("poweRlaw"))
suppressMessages(library("getopt"))

spec <- matrix(c("help"  , "h", 0, "logical"  , "print help messages",
                 "input" , "i", 1, "character", "input file in TSV format with header",
                 "title" , "t", 2, "character", "set figure title",
                 "output", "o", 2, "character", "set output pdf name"),
                 byrow = TRUE, ncol = 5)

usage <- function(x) {
        cat("\nA Script ....\n")
        cat("Author:#############\n")
        cat("Date  : 2019-12-14\n")
        cat("Required Packages: poweRlaw, getopt\n\n")
        cat(getopt(x, usage = TRUE))
        q(status = 1)
}
opt = getopt(spec)

你可能感兴趣的:(2020-07-06 R命令行参数解析)