我是R新手。我想用我的for循環使用cbind的結果來填充一個空矩陣。我的問題是,如何消除矩陣第一列中的NAs。我在下面列出了我的代碼:如何在R中創建一個空矩陣?
output<-matrix(,15,) ##generate an empty matrix with 15 rows, the first column already filled with NAs, is there any way to leave the first column empty?
for(`enter code here`){
normF<-`enter code here`
output<-cbind(output,normF)
}
輸出是我期望的矩陣。唯一的問題是,它的第一列填充了NAs。我如何刪除這些NAs?
太謝謝你了!
在R這是一個非常糟糕的主意。越來越多的結構使代碼非常緩慢。 – Fernando