Thanks Z.

Let me clarify my problem a bit further ... as I don't think I could use cut() or spine() to solve it.

I have a data frame with three columns (A, B, Value).  'A' and 'B' are categorical and 'Value' is continuous and non-negative.  I'm looking to make a mosaic plot with A on one axis and B on the other.  The size (i.e. area) of the tiles would correspond to the proportion of the total Value represented by the given combinations of the levels of A and B.

Thanks again,
Mauricio



________________________________
From: Achim Zeileis <Achim.Zeileis@uibk.ac.at>

Cc: "r-help@r-project.org" <r-help@r-project.org>
Sent: Wednesday, September 14, 2011 1:45 PM
Subject: Re: [R] Can 'mosaic' be used with a continuous variable?

On Wed, 14 Sep 2011, Mauricio Cornejo wrote:

> Hello,
> 
> I'm wondering if the 'mosaic' plot of the vcd package (or any other function for that matter) can be used with a continuous variable that should be represented via various categorical variables.? All the documentation I've read lead me to believe that it only works with counts of categories.
> 
> Alternatively, I've thought of first creating a contingency table where the frequencies would really be the values of my continuous variable as opposed to counts ... but I don't know how to do that.

Well, you can always use cut() to create a categorical variable from a continuous variable. But you have to do that in advance before calling mosaic().

For a bivariate display with a continuous x and a categorical y, you can use spine() which does the categorization for you.

hth,
Z

> Any insight would be appreciated.
> 
> Thanks,
> Mauricio
> 
>     [[alternative HTML version deleted]]
> 
> 
	[[alternative HTML version deleted]]

