[R] defmacro and bwplot incompatibilities?

Geoffrey lordgeoffrey at optusnet.com.au
Mon Dec 10 12:41:27 CET 2012


Perfect, thanks very much.

On 10/12/12 02:00, Jeff Newmiller wrote:
> 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