[R] How to create a correlation table for categorical data???

From: fabio crepaldi <crepaldi_fabio_at_yahoo.it>
Date: Thu 05 Jan 2006 - 06:07:53 EST

  I need to create the correlation table of a set of categorical data (sex, marital_status, car_type, etc.) for a given population.   Basically what I'm looking for is a function like cor( ) working on factors (and, if possible, considering NAs as a level).    

  To better express myself, the manual way should be:

  1. to create a set of n-1 numeric dummies (whose assigned values are 0,1) for each factor of n levels;
  2. to cbind them into a data.frame;
  3. to apply the cor( ) function to this data.frame.

  But that takes time and I'll have to do it for several different datasets with different levels... There must be a smartest and quickest way.   Is there anybody who can help me???
  Many thanks guys,


        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jan 05 07:25:28 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:50 EST