Hi R Experts,
How do you get the ... to work in a user-defined function such as the one I
have below?
For example if I want to pass replace=TRUE to the sample function.
# This is a sample function that generates x rows of z numbers out of y.
Basically a lottery style data set.
]
Sent: Monday, November 18, 2013 6:00 PM
To: Lopez, Dan
Cc: R help (r-help@r-project.org)
Subject: Re: [R] Passing parameters in a user defined function to another
function using ...
Hi,
It's easy, just carry the arguments in '...' forward to where you expect to
pass them along.
mynumbs
numbs - rbind(numbs, sort(sample(y, z, ... )))
See
?Reserved
which sends you to 'Introduction to R'
Rich
On Mon, Nov 18, 2013 at 8:52 PM, Lopez, Dan lopez...@llnl.gov wrote:
Hi R Experts,
How do you get the ... to work in a user-defined function such as the one I
have below?
For example
Hi,
It's easy, just carry the arguments in '…' forward to where you expect to pass
them along.
mynumbs-function(x,y,z=5,...){
numbs-sort(sample(y,z, ...))
for (i in 1:(x-1))
numbs-rbind(numbs,sort(sample(y,z, ...)))
print(numbs)
}
Cheers,
Ben
On Nov 18, 2013, at 8:52 PM, Lopez, Dan
Hi Annie,
The error is in the R script...you start reading with Args[1] but instead
you should start with Args[5] etc. because (I believe) that R --slave
--vanilla --args count as
[1] [2][3][4]
Therefore, Args[5] it's the first argument you
Hi Annie,
while I don't use python, I've been in similar positions.
here's a good link for the arguments function. It's the best
example/tutorial I've seen on the topic. It will also help you perhaps to
print the values of the arguments to screen/file within R to see if things
are going okay.
Hi,
I've got an R script that I'm trying to turn into a ArcGis script tool so
that I can run it from ModelBuilder in Arc. Arc isn't giving me any errors
when I run the model holding the current tool, but the run time for the R
script is 0 seconds. I don't know if the parameters aren't being
How do I pass parameters to R script in Rgui ? Currently, I am using
source(foo.R).
Thanks
__
R-help@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
] On
Behalf Of Daren Tan
Sent: Friday, March 27, 2009 8:45 AM
To: r-help@r-project.org
Subject: [R] Passing parameters to R script in Rgui
How do I pass parameters to R script in Rgui ? Currently, I am using
source(foo.R).
Thanks
__
R-help@r-project.org mailing
I knowf R functions ca be called passing some parameters.
My first question is: how are parameters passed to R functions ?
Browsing through R archives I found an answer confirming taht parameters can
be passed to the called function by value. I wonder whether passing the
parameter
address is
No you can not pass an address to a function. If you want to change
the value of something, then return it as a value and assign it to the
object so you can see what is going on. Must be coming from the C
environment where such things are allowed and lead to a number of
problems.
If you really
R's variable passing mechanism is not call by value, but a mixture of
unevaluated arguments (like the obsolete Lisp FEXPR) and call-by-need.
It is like FEXPR in that the function can capture the unevaluated
argument (using 'substitute'). But it is like call-by-need in that
normal use of the
...@alice.it
Cc: r-h...@stat.math.ethz.ch; r-help@r-project.org
Oggetto: Re: [R] passing parameters to an R script
No you can not pass an address to a function. If you want to change
the value of something, then return it as a value and assign it to the
object so you can see what is going on. Must
holtman [mailto:jholt...@gmail.com]
Inviato: sab 03/01/2009 21.12
A: mau...@alice.it
Cc: r-h...@stat.math.ethz.ch; r-help@r-project.org
Oggetto: Re: [R] passing parameters to an R script
No you can not pass an address to a function. If you want to change
the value of something, then return
14 matches
Mail list logo