Hi John, Look at ?match.call you will need to make sure that expand.dots = TRUE, but I think it does what you want. The names you want might be:
names(my_list) <- as.character(match.call(expand.dots = TRUE))[-1L] I will point out that I am not sure you will get the desired results with your function as it is written. I think you might want: f <- function(...) { d <- list(...) lapply(d, function(x){x}) } instead. Hope this helps, Josh On Sun, Jul 17, 2011 at 10:59 AM, John Lande <john.land...@gmail.com> wrote: > dear all, > > a simple question, I need to write a function in which I retrive an > undetermined number of vector in the function. > > I solved the problem thanks to this link > > http://stackoverflow.com/questions/2540232/how-to-allow-multiple-inputs-from-user-using-r > > so my function will look alike this > > my_fun <- function(...){ > my_list <- lapply(..., function(x){x}) > } > > I need just one more suggestion. > > how can give to each element of the list the name of the single variables I > used as imput of "my_fun"?? > > I hope I was clear in what I want to do > > [[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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles https://joshuawiley.com/ ______________________________________________ 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.