我需要下載300多個可在線的.csv文件,並將它們合併到R的數據框中。它們都有相同的列名,但長度(行數)不同。將在線的.csv文件合併到R的數據框中
l<-c(1441,1447,1577)
s1<-"https://coraltraits.org/species/"
s2<-".csv"
for (i in l){
n<-paste(s1,i,s2, sep="") #creates download url for i
x <- read.csv(curl(n)) #reads download url for i
#need to sucessively combine each of the 3 dataframes into one
}
'read.csv'接受網址:'TMP < - do.call('rbind ',tmp1 < - Vectorize(read.csv,SIMPLIFY = FALSE)(paste0(s1,l,s2)))'其中'tmp1'將您的數據框列表和'tmp'組合爲 – rawr