-2
重複任務,我有30個字符的載體:的R - 爲每一個字符向量
tm <- c("CHI","CLE","IND","MIA","TOR","ATL","BOS","ORL","CHO","DET","NYK","WAS","MIL","BRK","PHI","GSW","SAS","OKC","DAL","MEM","LAC","UTA","HOU","MIN","POR","PHO","SAC","DEN","NOP","LAL")
我試圖創建這些字符的新對象。對象是一個列表從下面的read_html功能造成:
html_TOR <- read_html("http://www.basketball-reference.com/teams/TOR/2016/gamelog/#tgl_advanced::none")
我怎樣才能創建一個循環,在分配的對象和URL替換函數「TOR」在TM向量的每個字符?
這是我可怕的企圖......善良。
for (i in tm) {html_[i] <- read_html("http://www.basketball-reference.com/teams/[i]/2016/gamelog/#tgl_advanced::none")}
謝謝...這個效果很不錯!我將不得不調整我的後續操縱,現在在列表上工作。 – dudemcgregor