> I wanted to simulate the Matlab DISPLAY function for some time now. After seeing a recent proposal by Gabor Grothendieck I came up with the following solution,
display <- function(...) { my_names <- lapply(substitute(placeholderFunction(...))[-1], deparse) for (my in my_names) cat(my, "=", eval(parse(text=my)), "\n", sep=" ") } that works about as good as I would have hoped: > a <- 1; b <- a + 1 > display(a, b, sin(1)) a = 1 b = 2 sin(1) = 0.841471 My questions: (1) Is there a better or more appropriate way to write such a function? --- I'm not so well versed in internal R functions such as (de)parse(), substitute(), or eval(). (2) What is the role of the "placeholderFunction"? I could not find enough information about it resp. about the whole construction. Thanks, Hans Werner ______________________________________________ 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.