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