我有兩個矩陣具有相同名稱的添加元素爲矩陣
Mdates<-c("8Q1","8Q2","8Q3","8Q4","9Q1","9Q2","9Q3","9Q4","10Q1","10Q2","10Q3","10Q4","11Q1","11Q2","11Q3","11Q4","12Q1","12Q2","12Q3","12Q4","13Q1","13Q2","13Q3","14Q1","14Q2")
Cr<-matrix(c("14Q2","13Q2","14Q2","14Q1","13Q4","13Q4","12Q4","13Q3","13Q4","12Q3","14Q2",12867.8,12710.7,10746.9,9634.4,8238.5,7835.2,7315.6,7263.1,7002.7,6104.8,5759.3),ncol=2,byrow=FALSE)
我添加的所有東西與鉻相同的名稱,並把它放在Mdates同一列名下,所以idealy它看起來像這個:
8Q1 8Q2 8Q3 8Q4 9Q1 9Q2 9Q3 9Q4 10Q1 10Q2 10Q3 10Q4 11Q1 11Q2 11Q3 11Q4 12Q1 12Q2 12Q3 12Q4 13Q1 13Q2 13Q3 13Q4 14Q1 14Q2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6104.8 7315.6 0 12710.7 7263.1 15241.3 9634.4 29373.9
完美!謝謝 – 2014-10-09 12:45:23