Skip to content
Prev 313266 / 398503 Next

defmacro and bwplot incompatibilities?

My macro doesn't work for bwplot. But is working elsewhere.
What changes should i make to fix my macro.
Thanks.

The complete code sample is:
library(gtools)
library(lattice)

pic <- defmacro(fn, plotfunc, expr={png(filename=fn); plotfunc; dev.off()})

# this one fails.
pic("bw.png", {bwplot(Species ~ Sepal.Length, data=iris)})

# this one works
pic("p.png", {plot(iris$Sepal.Length)}