R CMD --args
2
0
Entering edit mode
@denrique-escobar-espinoza-1303
Last seen 9.7 years ago
anyone knows how to use arguments in R, I use linux and the comand line only... i would like to pass arguments in R like we do in perl ex= perl myProgram.pl arg1 arg2 ... argn thanks
• 777 views
ADD COMMENT
0
Entering edit mode
Seth Falcon ★ 7.4k
@seth-falcon-992
Last seen 9.7 years ago
"D.Enrique ESCOBAR ESPINOZA" <escobarebio at="" yahoo.com=""> writes: > anyone knows how to use > arguments in R, > I use linux and the comand line only... > i would like to pass arguments in R like we do in perl > ex= perl myProgram.pl arg1 arg2 ... argn > thanks You probably want to read about commandArgs(). There are some threads related to this topic in the R-help archives. It might also make sense to direct further questions there as this isn't a bioconductor specific question. Best, + seth
ADD COMMENT
0
Entering edit mode
Weiwei Shi ★ 1.2k
@weiwei-shi-1407
Last seen 9.7 years ago
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20060410/ 8b29d201/attachment.pl
ADD COMMENT
0
Entering edit mode
It may not be the nicest of all possible solutions but has some practical value for me. You can cat a script through sed and into R. From the Unix shell you can do: echo 'cat(file=SOMEFILENAME,"hello world")' | \ sed -e 's/SOMEFILENAME/"hello.txt"/' | /usr/bin/R > /dev/null The "echo" is the UNIX command, the "cat" is the R function. If you need the output then one can redirect it to some file. commandArgs would do for the example above and for most other cases, I personally find the above easier as it does not require argument parsing and it has some particular charm when combined with Makefiles. But commandArgs is the way to do it right, I am afraid. Best regards Steffen Am Montag 10 April 2006 18:43 schrieb Weiwei Shi: > You can also try this way: > arg_variable1 = arg1 > export arg_variable1 > in linux command and then get them by using the following in R: > arg1 <- Sys.getenv("arg_variable1") > > HTH, > > weiwei > > On 4/10/06, D.Enrique ESCOBAR ESPINOZA <escobarebio at="" yahoo.com=""> wrote: > > anyone knows how to use > > arguments in R, > > I use linux and the comand line only... > > i would like to pass arguments in R like we do in perl > > ex= perl myProgram.pl arg1 arg2 ... argn
ADD REPLY

Login before adding your answer.

Traffic: 548 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6