[R] Export bug? Hist() vs. barchart().

David Winsemius dwinsemius at comcast.net
Sun Apr 4 06:02:42 CEST 2010


On Apr 3, 2010, at 7:20 PM, Jeff Brown wrote:

>
> Hi,
>
> If you want to export a single bar chart, this works:
>> png( "ET" );
>> barchart( data[,"ET"] )
>> dev.off()
> quartz_off_screen
>                2
>
> But if you want to export a few of them, this does not:
>> factorCols <- c("MR","ET");
>> sapply( factorCols,	function(x) {
> + 	png( x );
> + 	barchart( data[, x] );
> + 	dev.off();
> + } );
> MR.quartz_off_screen ET.quartz_off_screen
>                   2                    2
>
> R gives no indication of an error, but the files do not appear in the
> working directory as they should.  Why is that?
>
> I'm led to suspect this is a bug,

It much more likely to be related to the FAQ item (memory suggested it  
was 7.21, but checking I see that I'm off by one)  that discusses why  
lattice functions won't plot as inexperienced useRs expect them to.

-- 
David


> because it works fine if you use hist()
> instead of barchart():
>> factorCols <- c("YR","AG");
>> sapply( factorCols,	function(x) {
> + 	png( x );
> + 	hist( data[, x] );
> + 	dev.off();
> + } );
> YR.quartz_off_screen AG.quartz_off_screen
>                   2                    2
>
> Thanks,
> Jeff
> -- 
> View this message in context: http://n4.nabble.com/Export-bug-Hist-vs-barchart-tp1750593p1750593.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list