How can I convert "plot(0, 1)" into "plot(x=0, y=1)"?
More generally, how can I get argument names assigned to function
calls in "language" objects?
Example:
tstFn <- function()plot(0, 1)
bo <- body(tstFn)
tstFnxy <- function()plot(x=0, y=1)
boxy <- body(tstFnxy)
Is there a function that will modify "bo" to match "boxy"?
My current solution requires me to know the names of the
arguments for "plot" (in this example). I'd prefer a more general
solution.
Thanks,
Spencer
p.s. I'm trying to create an animation by repeatedly calling a function
that contains something like text(0, 1, "abc"). By computing on the
language object 'text(0, 1, "abc")', I can call text(0, 1, 'a') the
first time, text(0, 1, 'ab') the second, and text(0, 1, 'abc') the
third. The function will be more general if I can get the names of the
arguments as just described.
______________________________________________
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.