-1
嗨,我有5個html源,我想在其中運行readHTMLTable
並存儲結果。我可以做到這一點單獨使用:R中的readHTMLTable在循環中拋出警告
readHTMLTable(iso.content[1],which=6)
readHTMLTable(iso.content[2],which=6)
.
.
但是把這個變成一個for
循環,當我得到:
library(XML)
> iso.table<-NULL
> for (i in 1:nrow(gene.iso)) {
+ iso.table[i]<-readHTMLTable(iso.content[i],which=6)
+ }
Warning messages:
1: In iso.table[i] <- readHTMLTable(iso.content[i], which = 6) :
number of items to replace is not a multiple of replacement length
2: In iso.table[i] <- readHTMLTable(iso.content[i], which = 6) :
number of items to replace is not a multiple of replacement length
3: In iso.table[i] <- readHTMLTable(iso.content[i], which = 6) :
number of items to replace is not a multiple of replacement length
4: In iso.table[i] <- readHTMLTable(iso.content[i], which = 6) :
number of items to replace is not a multiple of replacement length
5: In iso.table[i] <- readHTMLTable(iso.content[i], which = 6) :
number of items to replace is not a multiple of replacement length
所以我可以單獨做到這一點,但不使用for
循環。我不打算用下一次迭代替換當前的數據,所以我不確定警告爲什麼會這樣。
有什麼想法?
感謝[[]]提示。 – brucezepplin 2014-09-04 08:06:34