Reputation: 41
CPT = cbind(CPTa$Seller,DisCPT,DisSellCPT)
CPT
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1715 10656.10 0.00 14642.54 21035.93 1268625.67 1274133.34 1242871.98
[2,] 2432 10655.38 14642.54 0.00 13977.05 1280809.90 1286142.97 1254953.24
[3,] 9991 10649.17 21035.93 13977.05 0.00 1289479.20 1295040.50 1263758.70
[4,] 29823984 10654.64 1268625.67 1280809.90 1289479.20 0.00 27399.00 30229.96
[5,] 785748 10654.76 1274133.34 1286142.97 1295040.50 27399.00 0.00 33043.67
[6,] 29824531 10659.36 1242871.98 1254953.24 1263758.70 30229.96 33043.67 0.00
I want to change the
[,1] to "Seller"
[,2] to "DC"
[,3] to [,8] to the values of column.
How to do I do that?
Upvotes: 0
Views: 69
Reputation: 56179
We can cbind with names, compare the outputs of below two examples:
cbind(mtcars$mpg, mtcars$cyl)
# [,1] [,2]
# [1,] 21.0 6
# [2,] 21.0 6
cbind(myName1 = mtcars$mpg, myName2 = mtcars$cyl)
# myName1 myName2
# [1,] 21.0 6
# [2,] 21.0 6
Upvotes: 2