[R] "Glueing" factors together

F. Tusell etptupaf at bs.ehu.es
Tue Jun 15 11:35:13 CEST 2004


Hi, Ted:

Probably not the most elegant way, but not too tedious either.

 >a  <- as.factor(c("A0","A1","A2"))
 >b  <- as.factor(c("B0","B1","B2"))
 > as.vector(outer(a,b,FUN=paste,sep=""))
[1] "A0B0" "A1B0" "A2B0" "A0B1" "A1B1" "A2B1" "A0B2" "A1B2" "A2B2"

Best, ft.

-- 
Fernando TUSELL                                e-mail:
Departamento de Econometría y Estadística           etptupaf at bs.ehu.es 
Facultad de CC.EE. y Empresariales             Tel:   (+34)94.601.3733
Avenida Lendakari Aguirre, 83                  Fax:   (+34)94.601.3754
E-48015 BILBAO  (Spain)                        Secr:  (+34)94.601.3740




More information about the R-help mailing list