[R] problems with mosaic plot

Michael Bibo michael_bibo at health.qld.gov.au
Thu Dec 16 03:03:39 CET 2010

kiotoqq <kiotoqq <at> googlemail.com> writes:

> I'm pretty sure that I did everything right, but my R is just not drawing the
> mosaicplot that I want, and there is also no error messege, looks like this
> right now:
> >  mosaicplot(arthritis)
> > mosaicplot(~ sex + treatment + improved, data = arthritis, color = TRUE)
> > 

Arthritis is a dataset contained in vcd package.  Have you installed *and* 
loaded the package?

Test with:
data (Arthritis)
But if this is the problem, there should be an error message like: "Error in 
mosaicplot(arthritis) : object 'arthritis' not found"

Do you have another graphics device open?  
to close all currently open devices, and then re-run mosaicplot command, but R 
is case-sensitive, hence:

mosaicplot(~ Sex + Treatment + Improved, data = Arthritis, color = TRUE)

Hope this helps,

Michael Bibo
Queensland Health

More information about the R-help mailing list