> tmp <- data.frame(G=factor(letters[c(1,2,3,1,2,3)]), + S=factor(LETTERS[c(1,1,1,2,2,2)])) > tmp G S 1 a A 2 b A 3 c A 4 a B 5 b B 6 c B > tmp$G.S <- with(tmp, interaction(G, S)) > tmp G S G.S 1 a A a.A 2 b A b.A 3 c A c.A 4 a B a.B 5 b B b.B 6 c B c.B >