platform       x86_64-apple-darwin9.8.0
arch           x86_64
os             darwin9.8.0
system         x86_64, darwin9.8.0
version.string R version 2.13.1 (2011-07-08)

I am trying to write a function that takes a few objects as input.

test <- function(directory, num = 1:100) {
> }


the argument, "num", has the default value. But when the function is
called, it can take an array as well,

test("directory", c(1, 2, 3))


I can parse the both arguments by converting them into string, but I am
wondering if there is a better (more efficient) way to achieve this.
Perhaps, using built-in R functions can help, I suppose?

Does anyone have any idea for the function taking more than one kind of
argument?


soichi

        [[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.

Reply via email to