Re: [R] relationship between two factors

From: Marc Schwartz <>
Date: Thu, 06 Dec 2007 13:08:49 -0600

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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 06 Dec 2007 - 20:26:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 06 Dec 2007 - 21:30:17 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.