Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
wrapper of Getopt::Long and simple variable interpolation in R
R
branch: master
Failed to load latest commit information.
R del zzz.R
inst revised tests for 'qq' function
man merge
test_run_command update readme
tests ready to ship
vignettes slight changes
.Rbuildignore Update .Rbuildignore
.gitignore first commit
.travis.yml Update .travis.yml
DESCRIPTION imporved description section
NAMESPACE merge
NEWS Update NEWS
README modify according to R-ext
README.md Update README.md

README.md

Build Status

This package wraps the powerful Perl module Getopt::Long and keeps almost all features of it. The syntax of option specification is as same as Getopt::Long. So if you are coming from Perl and you know Getopt::Long, it would be no difficulty with using it. This package supports default values, imports option names into working environment, and automatically generates help messages. The usage is very simple:

library(GetoptLong)
cutoff = 0.05
GetoptLong(c(
    "cutoff=f", "cutoff of something (default is 0.05)",
    "input=s%", "input file",
    "verbose!", "print messages"
))

Then you can run this script by:

Rscript foo.R --cutoff 0.01 --input file=foo.txt --verbose
Rscript foo.R -i file=foo.txt -v
Rscript foo.R -i file=foo.txt --no-verbose

Help message can be automatically generated:

> Rscript test_list.R --help
Usage: Rscript foo.R [options]

  --cutoff numeric
    cutoff of something (default is 0.05)

  --input { name=character, ... }
    input file

  --verbose
    print messages

  --help
    Print help message and exit

  --version
    Print version information and exit

This package also supports simple variable interpolation in R, which means you can embed variables into texts directly, just like in Perl.

r = c(1, 2)
value = 4
name = "name"
qq("region = (@{r[1]}, @{r[2]}), value = @{value}, name = '@{name}'")

So it would be much easier for you to construct complicated texts instead of using annoying paste.

Something went wrong with that request. Please try again.