Is there a way to specify a *vector* of statements, as an argument to a
function. What I'm trying to do is to provide the ability to add elements
to a series of panels drawn by a function. (As documented, split.screen
does not provide this capability.) My idea is to mimic the 'plot.axes'
argument of filled.contour(), but with indexed statements to be executed. A
series of tests is given below. (NOTE: I know that I can use parse() on
character strings, but I'm trying to avoid forcing users of the function to
deal with nested quote marks, and the filled.contour scheme seems elegant to
my eye.)
> f<-function(x){x[[1]]}
> f(list({cat("a\n")},{cat("b\n")}))
a
b
>
> f(c({cat("a\n")},{cat("b\n")}))
a
b
NULL
>
> f({{cat("a\n")},{cat("b\n")}})
Error: syntax error
>
--
View this message in context:
http://www.nabble.com/how-to-index-statements-provided-as-function-args--tp23056258p23056258.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
[email protected] 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.