[R] Problem with do.call().

Rolf Turner r.turner at auckland.ac.nz
Fri Mar 28 00:17:58 CET 2014



I was under the impression that

	do.call(foo,list(x=x,y=y))

should yield the same result as

	foo(x,y).

However if I do

	x <- 1:10
	y <- (x-5.5)^2
	do.call(plot,list(x=x,y=y))

I get the expected plot but with the y-values (surrounded by c()) being 
printed (vertically) in the left-hand margin of the plot.

The help for do.call() says:

> The behavior of some functions, such as substitute, will not be the
> same for functions evaluated using do.call as if they were evaluated
> from the interpreter. The precise semantics are currently undefined and
> subject to change.

Am I being bitten by an instance of this phenomenon?  Seems strange.

I would be grateful for enlightenment.

cheers,

Rolf Turner



More information about the R-help mailing list