tag:blogger.com,1999:blog-1901659770749170850.post3844584129701932325..comments2018-11-27T06:39:27.023-05:00Comments on Quantitative Ecology: Including arguments in R CMD BATCH modeForesterhttp://www.blogger.com/profile/00291122844817714304noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-1901659770749170850.post-68811902801678575942012-09-19T18:08:33.018-04:002012-09-19T18:08:33.018-04:00Yes, thanks for an actual working exampleYes, thanks for an actual working exampleKatyahttps://www.blogger.com/profile/08607532593303695619noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-39794275981956613342012-04-02T12:04:24.171-04:002012-04-02T12:04:24.171-04:00This has been very useful! Thanks for giving such ...This has been very useful! Thanks for giving such a clear explanation!Omar Al Hammalhttps://www.blogger.com/profile/03126560490624019720noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-65357640279202474612012-04-02T12:01:53.374-04:002012-04-02T12:01:53.374-04:00This has been very useful! Thanks for giving such ...This has been very useful! Thanks for giving such a clear explanation!Omar Al Hammalhttps://www.blogger.com/profile/03126560490624019720noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-53985220656803982182012-03-16T11:38:53.905-04:002012-03-16T11:38:53.905-04:00Thank you very much for this post. It really helpe...Thank you very much for this post. It really helped to run by R script with command line parameters in batch mode. Also, this is the only illustrated example I found on the web.nirmalyahttps://www.blogger.com/profile/13668071604442988171noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-79547204722584199982012-02-22T17:56:45.407-05:002012-02-22T17:56:45.407-05:00One more thanks, plus note that I posted an adapte...One more thanks, plus note that I posted an adapted (and, I believe, improved) version to <a href="http://rosettacode.org/wiki/Command-line_arguments#R" rel="nofollow">Rosetta Code</a>.Tom Rochehttps://www.blogger.com/profile/02860614024937471220noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-84452299831480169592011-01-19T10:29:41.762-05:002011-01-19T10:29:41.762-05:00Thank you very much, it's been really useful!Thank you very much, it's been really useful!Unknownhttps://www.blogger.com/profile/15461930817281468771noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-30624671222501345342010-05-21T16:29:22.979-04:002010-05-21T16:29:22.979-04:00Thanks for this post.
As a note, Matthew's ge...Thanks for this post.<br /><br />As a note, Matthew's getArgs() function is not going to work because of a scoping problem. The variables defined using eval(...) will not be see outside of the getArgs() function.zingiberhttps://www.blogger.com/profile/01500931939072109445noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-77953294353079374212009-11-04T05:37:38.132-05:002009-11-04T05:37:38.132-05:00Useful post!
Thank you very much! MichelaUseful post!<br />Thank you very much! MichelaUnknownhttps://www.blogger.com/profile/14122853792531945570noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-80322517697239699432009-10-01T00:16:52.499-04:002009-10-01T00:16:52.499-04:00Thanks for this solution! Taking this a little f...Thanks for this solution! Taking this a little further you can define a function which fetches the command line arguments. <br /><br />getArgs = function() {<br /> args=(commandArgs(TRUE))<br /> if(length(args) > 0) {<br /> for (i in 1:length(args)){<br /> eval.parent (parse(text=args[[i]]))<br /> } # end for<br /> } # end else<br />} # end getArgs<br /><br />Assuming the above function is stored in a local file called 'getArgs.R' the user would include the following at the start of each batch script.<br /><br />source("getArgs.R")<br /># Set defaults first<br />a=1; b= c(2,3)<br /># Next fetch command line arguments<br />getArgs()<br /><br />:)Matthewhttps://www.blogger.com/profile/16724020709892511443noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-86592839787453888252009-08-25T07:42:07.837-04:002009-08-25T07:42:07.837-04:00Thank you very much. This worked very well.Thank you very much. This worked very well.gengiskanhg.geohttps://www.blogger.com/profile/15937065506618028397noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-55805270366197034932009-08-25T07:41:49.046-04:002009-08-25T07:41:49.046-04:00Thank you very much. This worked very well.Thank you very much. This worked very well.gengiskanhg.geohttps://www.blogger.com/profile/15937065506618028397noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-74775053754290000172008-03-19T17:38:00.000-04:002008-03-19T17:38:00.000-04:00I found that the script came up with a syntax erro...I found that the script came up with a syntax error (running R 2.4.1). Instead of:<BR/><BR/>}else{<BR/><BR/>try:<BR/><BR/>} else {<BR/><BR/>This seemed to fix the script.Alex Reynoldshttps://www.blogger.com/profile/11205133717453007006noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-66570464428649798422008-02-12T20:24:00.000-05:002008-02-12T20:24:00.000-05:00Ditto what Kevin said; the R mailing list and pret...Ditto what Kevin said; the R mailing list and pretty much every other google result out of 10 or so just mentioned the commandArgs() function with little illustration. Thanks!Keithhttps://www.blogger.com/profile/06985399643447783609noreply@blogger.comtag:blogger.com,1999:blog-1901659770749170850.post-91385221591067299252007-08-21T13:49:00.000-04:002007-08-21T13:49:00.000-04:00FYI, this is the first working command line args e...FYI, this is the first working command line args example I've seen. The R list uniformly says "help(commandArgs), HTH." which is unhelpful. Kudos.Kevinhttps://www.blogger.com/profile/06840263647501223175noreply@blogger.com