Mercurial > repos > greg > r_hello_world
annotate hello_world.R @ 11:887b76c1b7d1 draft default tip
Deleted selected files
| author | greg |
|---|---|
| date | Tue, 16 Aug 2016 09:51:53 -0400 |
| parents | 5875cb5f42d4 |
| children |
| 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) |
| 7 | 11 args <- parse_args(parser, positional_arguments=TRUE) |
| 4 | 12 opt <- args$options |
| 13 | |
| 2 | 14 fileConn<-file(opt$output) |
| 8 | 15 writeLines(c("Hello World!"), fileConn) |
| 2 | 16 close(fileConn) |
| 0 | 17 |
| 2 | 18 |
