Skip to content
Prev 178874 / 398506 Next

Evaluation of an expression as function argument

Sebastien Bihorel wrote:
Way 1:

for(i in seq(2))
   do.call("plot", c(list(1:10), as.list(items[i])))


Way 2 is perhaps easier for you:


items <- list(col=2, pch=2)
for (i in seq(2))
   do.call("plot", c(list(1:10), items[i]))


Ways 3...n up to others...


Uwe Ligges