I think this is due to the conversion to matrix performed by the simplify parameter. If you do not use it, you will receive:
combn( x , 2 , simplify=FALSE) [[1]] [1] ab Levels: abc [[2]] [1] ac Levels: abc [[3]] [1] bc Levels: abc
The fact that the first column is OK is related to how combn works: the first column is set separately, and the remaining columns are then changed from the existing matrix using [<- . Consider:
m <- matrix(x,3,3) m[,2] <- sample(x) m [,1] [,2] [,3] [1,] "a" "1" "a" [2,] "b" "3" "b" [3,] "c" "2" "c"
I think the disturbing function is therefore [<- .
James source share