Created
August 10, 2022 08:21
-
-
Save nick-youngblut/3bf00cc0ba1a06cdb3b82487b1c337ab to your computer and use it in GitHub Desktop.
boilerplate for argparse R script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
# library | |
suppressPackageStartupMessages(library("argparse")) | |
# create parser object | |
parser <- ArgumentParser() | |
# specifying options | |
parser$add_argument("file", nargs=1, help="File to be displayed") | |
parser$add_argument("-v", "--verbose", action="store_true", default=TRUE, | |
help="Print extra output [default]") | |
parser$add_argument("-q", "--quietly", action="store_false", | |
dest="verbose", help="Print little output") | |
args <- parser$parse_args() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment