[R] User's function

2009-12-04 Thread Lisa
Hello, All, I want to write a function to do some works based on the arguments. For example, bind some variables (arguments) as this: myfunction - function(arg1, arg2, arg3, …) { x - cbind(arg1, arg2, arg3, …) } myfunction(arg1, arg2, arg3, …) The function can automatically determine

Re: [R] User's function

2009-12-04 Thread baptiste auguie
Hi, try ?do.call do.call(cbind, replicate(3, 1:10, simplify=FALSE)) HTH, baptiste 2009/12/4 Lisa lisa...@gmail.com: Hello, All, I want to write a function to do some works based on the arguments. For example, bind some variables (arguments) as this: myfunction - function(arg1, arg2,

Re: [R] User's function

2009-12-04 Thread Lisa
Thank you for your reply. But this is not what I want. For example, I have several variables, like arg1 - c(1, 2, 3, 5, 6, 6) arg2 - c(3, 1, 5, 5, 7, 8) arg3 - c(8, 10, 4, 0, 9, 1) arg4 - c(11, 22, 30, 5, 61, 22) … I just want to bind some of these variables based on the arguments assigned in

Re: [R] User's function

2009-12-04 Thread Phil Spector
Lisa - I think this is what you're looking for: myfunction = function(...)do.call(cbind,list(...)) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] User's function

2009-12-04 Thread Lisa
Exactly, that's waht I want. Thank you very much! Lisa Phil Spector wrote: Lisa - I think this is what you're looking for: myfunction = function(...)do.call(cbind,list(...)) - Phil Spector