R语言 矩阵如何在while()中循环加入行

Python026

R语言 矩阵如何在while()中循环加入行,第1张

while(...){

    #do something...

    your.matrix<-rbind(your.matrix,row.to.be.added)

    #do something...

}

mat <- matrix(1:10, ncol=2)#矩阵mat

rbind(mat, c(6, 11))#增加一行

cbind(mat, c(11,12,13,14,15))#增加一列