You could try something like this : plot_test <- function(...) { args <- list(...) par(mfrow = c(length(args), 1)) lapply(args, plot) } plot_test(1:5) plot_test(1:5, 5:1, 3:7)
2008/11/14 Chang Jia-Ming <[EMAIL PROTECTED]> > I want to write a function to plot a picture for each inputting file like > the following example. > plot_test <- function(f1,f2) > { > plot_file(f1); > plot_file(f2); > } > > However, the above function just could plot two input file. > If the number of input file is not sure, it could be 2, 3 or more. > plot_test(f1, f2) > plot_test(f1, f2, f3) .... or more > I would like to run function, for instance "plot_file", for each input > file. > How could I do? > Is there any solution like argv and argc in C to read arguments in R? > > Thank you. > > Jia-Ming > > [[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. > [[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.