[R] mca & contingency tables - error: "All variables must be factors"

g gina.joue at ucd.ie
Fri Jun 13 03:09:27 CEST 2003


Hi,

I would like to do a multiple correspondence analysis with the mca function in 
the MASS library on data that I have as a contingency table (which I've tried 
converting to a data frame).

For example,
=========
		> data(HairEyeColor)
		> hair.df <- as.data.frame(HairEyeColor)
		> hair.df
    Hair   Eye    Sex Freq
1  Black Brown   Male   32
2  Brown Brown   Male   38
3    Red Brown   Male   10
4  Blond Brown   Male    3
5  Black  Blue   Male   11
6  Brown  Blue   Male   50
7    Red  Blue   Male   10
8  Blond  Blue   Male   30
9  Black Hazel   Male   10
10 Brown Hazel   Male   25
11   Red Hazel   Male    7
		> mca(hair.df)
	Error in mca(hair.df) : All variables must be factors
=========

What are the manipulations I must do on the data in order for mca to work?

Any help appreciated....
Gina




More information about the R-help mailing list