[R] Function to convert categorical variable in numerical

2007-05-24 Thread J.Andrés Martínez
Hello everybody, I am a new R user. At current moment I need to do a Principal Components Analysis with a table who contain mixed variables (categorical and numerical). There is some function available in R for transform these variables? For example: I need transform the categorical variable X

Re: [R] Function to convert categorical variable in numerical

2007-05-24 Thread Prof Brian Ripley
?model.matrix ?contr.treatment Whether this makes sense for PCA is another matter: princomp() contains a test to stop this happening automatically with a formula argument. One problem is the result depends on just how you do the transformation. On Thu, 24 May 2007, J.Andrés Martínez wrote:

Re: [R] Function to convert categorical variable in numerical

2007-05-24 Thread Mark Difford
Hi J. Andres, You are probably better off using the ade4 package, which has two functions that will do exactly what you want, i.e. a PCA using mixed quantitative and categorical variables: ## You will need to download ade4 first library(ade4) ?dudi.hillsmith ?dudi.mix Regards, Mark Difford.

Re: [R] Function to convert categorical variable in numerical

2007-05-24 Thread J.Andrés Martínez
Hello again, I got it with dudi.mix included in ade4 library that Mark told. Thank you very much to all! J. Andres On 5/24/07, Mark Difford [EMAIL PROTECTED] wrote: Hi J. Andres, You are probably better off using the ade4 package, which has two functions that will do exactly what you