getopt
R package providing basic command line optional argument parsing
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 3 committers (66.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.1%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
R package providing basic command line optional argument parsing
Basic Info
Statistics
- Stars: 12
- Watchers: 2
- Forks: 7
- Open Issues: 2
- Releases: 4
Created about 13 years ago
· Last pushed almost 3 years ago
Metadata Files
Readme
Contributing
License
README.rst
getopt
======
.. image:: https://www.r-pkg.org/badges/version/getopt
:target: https://cran.r-project.org/package=getopt
:alt: CRAN Status Badge
.. image:: https://github.com/trevorld/r-getopt/workflows/R-CMD-check/badge.svg
:target: https://github.com/trevorld/r-getopt/actions
:alt: R-CMD-check
.. image:: https://codecov.io/github/trevorld/r-getopt/branch/master/graph/badge.svg
:target: https://app.codecov.io/github/trevorld/r-getopt?branch=master
:alt: Coverage Status
.. image:: https://cranlogs.r-pkg.org/badges/getopt
:target: https://cran.r-project.org/package=getopt
:alt: RStudio CRAN mirror downloads
.. image:: https://tinyverse.netlify.com/badge/getopt
:target: https://cran.r-project.org/package=getopt
:alt: Number of dependencies
.. raw:: html
``getopt`` is an R package designed to be used with ``Rscript`` to write
"#!"-shebang scripts that accept short and long flags/options. Many users will
prefer using instead the package `optparse `_
which adds extra features (automatically generated help option and usage,
support for default values, basic positional argument support).
To install the last version released on CRAN use the following command:
.. code:: r
install.packages("getopt")
To install the development version use the following command:
.. code:: r
install.packages("remotes")
remotes:install_github("trevorld/r-getopt")
example
-------
An example Rscript using ``getopt``:
.. code:: r
#!/path/to/Rscript
library('getopt')
# get options, using the spec as defined by the enclosed list.
# we read the options from the default: commandArgs(TRUE).
spec = matrix(c(
'verbose', 'v', 2, "integer",
'help' , 'h', 0, "logical",
'count' , 'c', 1, "integer",
'mean' , 'm', 1, "double",
'sd' , 's', 1, "double"
), byrow=TRUE, ncol=4)
opt = getopt(spec)
# if help was asked for print a friendly message
# and exit with a non-zero error code
if ( !is.null(opt$help) ) {
cat(getopt(spec, usage=TRUE))
q(status=1)
}
# set some reasonable defaults for the options that are needed,
# but were not specified.
if ( is.null(opt$mean ) ) { opt$mean = 0 }
if ( is.null(opt$sd ) ) { opt$sd = 1 }
if ( is.null(opt$count ) ) { opt$count = 10 }
if ( is.null(opt$verbose ) ) { opt$verbose = FALSE }
# print some progress messages to stderr, if requested.
if ( opt$verbose ) { write("writing...",stderr()) }
# do some operation based on user input.
cat(rnorm(opt$count,mean=opt$mean,sd=opt$sd),sep="\n")
# signal success and exit.
# q(status=0)
Owner
- Name: Trevor L Davis
- Login: trevorld
- Kind: user
- Location: Stanford, CA
- Repositories: 29
- Profile: https://github.com/trevorld
Studies electricity markets
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: about 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Trevor Davis | t****s@g****m | 38 |
| Trevor L. Davis | t****s@s****u | 9 |
| trevor | t****d@s****u | 2 |
Committer Domains (Top 20 + Academic)
stanford.edu: 2
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 11
- Total pull requests: 0
- Average time to close issues: 6 months
- Average time to close pull requests: N/A
- Total issue authors: 7
- Total pull request authors: 0
- Average comments per issue: 1.73
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- trevorld (5)
- mlrus (1)
- jeffpbruce (1)
- romanzenka (1)
- derrickoswald (1)
- gtamazian (1)
- foldager (1)
Pull Request Authors
Top Labels
Issue Labels
enhancement (3)
help wanted (2)
bug (1)
wontfix (1)
invalid (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 30,415 last-month
- Total docker downloads: 35,088,972
- Total dependent packages: 4
- Total dependent repositories: 24
- Total versions: 14
- Total maintainers: 1
cran.r-project.org: getopt
C-Like 'getopt' Behavior
- Homepage: https://github.com/trevorld/r-getopt
- Documentation: http://cran.r-project.org/web/packages/getopt/getopt.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 1.20.4
published almost 3 years ago
Rankings
Downloads: 1.3%
Dependent repos count: 5.5%
Forks count: 8.8%
Dependent packages count: 9.1%
Average: 9.6%
Stargazers count: 15.4%
Docker downloads count: 17.3%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- stats * imports
- covr * suggests
- testthat * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- actions/upload-artifact main composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite