Your specific example can just use 'prod'. The 'prod' function uses the '...' construct which I think is what you are looking for.
However, in concurrence with a previous answer, it is almost surely going to be a good idea to change your way of thinking about the problem. One word in the R world to search for is: vectorization On 16/07/2010 02:32, Axel Urbiz wrote:
Dear users, My apologies for the simple question. I'd like to create a function where the number of arguments is as big as the size of my data set. Supose I have n observations in my data, how can I write a function like fun<- function (x1,x2,....,xn) {x1*x2*.......*xn} Thanks in advance for your help! Axel. [[alternative HTML version deleted]] ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.
-- Patrick Burns pbu...@pburns.seanet.com http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno') ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.