看板 Statistics 關於我們 聯絡資訊
請問我想用R從連續捉取work1.txt work2.txt...的資料檔時該怎麼做 也就是 work1<-matrix(scan("work1.txt")) work2<-matrix(scan("work2.txt")) .... workn<-matrix(scan("workn.txt")) Code: for(i in 1:100) assign( paste("work", i, sep=""), matrix(scan(paste("work",i,"txt",sep="."))) error是在第三列應該是work1.txt, 但是code卻會產生work.1.txt造成讀檔失敗。 請問該如何改才能產生灰字碼的效果,或是有其它更簡潔的方法。 謝謝^^" -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.86.139
songyang:paste("work",i,".txt",sep="") 試試 11/22 20:39
bcs:it works!! thx much 11/22 22:08