我有好几个名字。我想将一个函数应用于名称的所有排列,以找出所有可能对的所有可能边的总和:
shapes<- c("Square", "Triangle","Octagon","Hexagon")
sides<-c(4,3,8,6)
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"
如何将所有排列的所有边相加?