Skip to content
Prev 333350 / 398502 Next

Passing parameters in a user defined function to another function using ...

Thanks Ben.

I feel really dumb. I did enter '...' in my sample function in another version of this function. But I just realized I had only done it for the second occurrence of the sample function and not the first.

Dan


-----Original Message-----
From: Ben Tupper [mailto:btupper at bigelow.org] 
Sent: Monday, November 18, 2013 6:00 PM
To: Lopez, Dan
Cc: R help (r-help at 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<-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" <lopez235 at llnl.gov> wrote:

            
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org