[R] output usage info to stdout

From: Hui Du <Hui.Du_at_dataventures.com>
Date: Wed, 20 Apr 2011 14:40:59 -0400


Hi all,

                I want to run a R code in the batch mode under UNIX system. Inside that code, I have a usage() function to give the hints regarding parameters. For example
usage = function()
{

    msg = "R CMD BATCH --save \"--args path=\\\"input_path\\\" file=\\\"input_file\\\" [seed=\\\"integer\\\" proportion=\\\"[0-1]\\\" outpath=\\\"output_path\\\" outfile=\\\"output_file\\\"]\" /S/hxd/utils/sampleRecords.r.txt";    print(msg);
}

                When I run the code like

R CMD BATCH mycode.R, I want to output the usage info if the required parameters are not there. But how to output the usage info listed above to standard out rather than to a file?

Thanks.

HXD         [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 20 Apr 2011 - 19:18:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 20 Apr 2011 - 20:00:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive