[R] defmacro and bwplot incompatibilities?

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sun Dec 9 17:00:17 CET 2012


bwplot is a trellis function. There is something very basic about the way that library works that any intro to trellis/lattice should tell you:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Geoffrey <lordgeoffrey at optusnet.com.au> wrote:

>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)}
>
>______________________________________________
>R-help at 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.




More information about the R-help mailing list