[R] relationship between two factors

Marc Schwartz marc_schwartz at comcast.net
Thu Dec 6 20:08:49 CET 2007


On Thu, 2007-12-06 at 12:51 +0000, christopher snow wrote:
> I have a dataset with two variables that are factors:
> 
> 1) Decision Making Satisfaction (DMS), values = A - Completely, B - 
> Mostly, C - Partly, D - Not at all
> 2) IT Satisfaction values (ITS), values = A - Completely, B - Mostly, C 
> - Partly, D - Not at all
> 
> I would like to produce a table (matrix) and a chart of the factors, 
> with counts at the cross sections:
> 
>          A   B   C   D
> A   
> B       counts
> C
> D
> 
> How can I do this in R?
> 
> Many thanks,
> 
> Chris


See ?table, for example:

  table(DMS, ITS)

You did not indicate the type of chart you want to create, but some
possibilities, using base graphics, would be barplot(), dotchart() and
mosaicplot(). The latter is in the vcd package on CRAN.

HTH,

Marc Schwartz



More information about the R-help mailing list