[R] Giving parameters from shell

2010-01-14 Thread cihan inan
Hi I want to give parameters for my function from the shell. I mean I defined a function like these: work1.R : myfunc - function(x,y) { z = x + y z } and now I want to use shell to give parameters like ./work1.R (3,5) to get sum 8. so what should I do? [[alternative HTML version

Re: [R] Giving parameters from shell

2010-01-14 Thread Paul Hiemstra
cihan inan wrote: Hi I want to give parameters for my function from the shell. I mean I defined a function like these: work1.R : myfunc - function(x,y) { z = x + y z } and now I want to use shell to give parameters like ./work1.R (3,5) to get sum 8. so what should I do?

Re: [R] Giving parameters from shell

2010-01-14 Thread cihan inan
I want to learn one more thing. You said args = commandArgs(TRUE) should I write this sentence in my function or out of my function area ? can you give me an example .r file ? 2010/1/14 Paul Hiemstra p.hiems...@geo.uu.nl cihan inan wrote: Hi I want to give parameters for my function from

Re: [R] Giving parameters from shell

2010-01-14 Thread Don MacQueen
Try for yourself and see. (it's not difficult to try) For example, put the line in both places, followed by print(args) and see what happens. -Don At 11:49 PM +0200 1/14/10, cihan inan wrote: Content-Type: text/plain Content-Disposition: inline Content-length: 1496 I want to learn one more