Charles C. Berry wrote:
> Try this:
> f2 <- function(...) sapply( substitute(list(...)), deparse )[-1]
Wow, this works. Thanks a lot!
For the usual purpose of 'substitute': to label something. The use case is that I have a function that takes an unspecified number of very large integer vectors which are visualized in some way. I first tried to pass all the vectors as one list, via '.Call', but that made R duplicate the vectors, when the list argument is built. So, I now use '...' and '.External', where duplication does not happen. I would like to conveniently label the vectors by the expression with which they have been passed (as 'plot' does, too), and with your construction, I can now extract the expressions as characters and pass them to make the labels.
Then, I am lucky that you offered a solution with 'deparse', not 'parse'. ;-) Still, I am (pleasently) surprised that the vectors within the '...' do not get duplicated (according to 'tracemem') by this construction.
Thank you very much
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Archive generated by hypermail 2.2.0, at Sun 06 Apr 2008 - 22:30:29 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.
list of date sections of archive