Dear R-Users, I have a data frame with several categorical variables. I want to create a new data frame with dummy variables (with all levels). I know the function model.matrix (see below) but it works only for one categorical variable :> tt <- c("a","a","b","a","c") > tt <- factor(tt) > model.matrix(~ tt - 1)is there anyone who have write such function ? Thanks for your help. Samir Messad Samir Messad E-Mail : messad at cirad.fr Statisticien CIRAD-EMVT TA 30/A Programme Productions Animales Campus de Baillarguet 34398 Montpellier cedex 5 (France) T?l : +33 (0)4-67-59-38-44 Fax : +33 (0)4-67-59-38-25 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear R-Users, I have a data frame with several categorical variables. I want to code these variables in dummy variables keeping all levels. I know the function model.matrix (see below) but it works only for one categorical variable :> tt <- c("a","a","b","a","c") > tt <- factor(tt) > model.matrix(~ tt - 1)Is there anyone who have write such function ? Thanks for your help. Samir Messad Samir Messad E-Mail : messad at cirad.fr Statisticien CIRAD-EMVT TA 30/A Programme Productions Animales Campus de Baillarguet 34398 Montpellier cedex 5 (France) T?l : +33 (0)4-67-59-38-44 Fax : +33 (0)4-67-59-38-25 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Reasonably Related Threads
- Fwd: Re: Finney's fiducial confidence intervals of LD50
- evaluation of the alternative expression in ifelse
- (PR#8905) Recommended package nlme: bug in predict.lme when an independent variable is a polynomial
- NOT an R problem: cannot install packages from distant repository
- surfaces and digital terrain model