我有几句话:
shapes<- c("Square", "Triangle","Octagon","Hexagon")
我想成对排列它们:
shapescount<-combn(shapes, 2)
shapescount
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] "Square" "Square" "Square" "Triangle" "Triangle" "Octagon"
[2,] "Triangle" "Octagon" "Hexagon" "Octagon" "Hexagon" "Hexagon"
我想计算成对中字母的每个分组,例如第一对是“6”代表“方形”,“8”代表“三角形”,第一对是“14”,依此类推。