Mercurial > repos > greg > r_hello_world
annotate hello_world.R @ 6:24ccb9f7b637 draft
Uploaded
author | greg |
---|---|
date | Mon, 15 Aug 2016 14:20:27 -0400 |
parents | a11f7a342777 |
children | d48f590690fe |
rev | line source |
---|---|
0 | 1 #!/usr/bin/env Rscript |
2 | |
3 suppressPackageStartupMessages(library("optparse")) | |
4 | |
5 | |
5 | 6 options_list <- list( |
0 | 7 make_option(c("-o", "--output"), action="store", help="Output dataset") |
8 ) | |
9 | |
4 | 10 parser <- OptionParser(usage="%prog [options] file", options_list) |
6 | 11 args <- parse+args(parser) |
4 | 12 opt <- args$options |
13 | |
2 | 14 fileConn<-file(opt$output) |
15 writeLines(c("Hello","World"), fileConn) | |
16 close(fileConn) | |
0 | 17 |
2 | 18 |