예를 들어 여러 날짜가있는 csv 파일이 있습니다. 날짜의 예
csv 파일의 각 날짜에 대해 여러 개의 zip 파일을 다운로드하고 싶습니다.
아래의 특정 예에서 날짜는 20151117로 지정됩니다. 대신 csv의 각 날짜에 대해 다운로드 할 수있는 방법이 있습니까? 아래 코드에 csv 파일을 포함하는 방법이 있습니까?
download.file("https://www.quandl.com/api/v3/databases/OSMV/download?download_type=20151117&api_key=my_api_key", destfile = "/Users/anders/Documents/Juni 2019/DATA/datatest.zip", mode="wb", method="libcurl")
내 질문이 이해되기를 바랍니다.
감사합니다
다음은 작동해야하는 작은 루프입니다.
df <- data.frame(all_dates = c("20150711","20160613"))
dates <- unique(df$all_dates) # create list of dates that you want
for (d in dates){ # each 'd' is one date
# create url to download from for each date
download.file(paste0("https://www.quandl.com/api/v3/databases/OSMV/download?download_type=", d, "&api_key=my_api_key",
# create destination file with date in the file name
destfile = paste0("/Users/anders/Documents/Juni 2019/DATA/datatest", d, ".zip",
mode="wb", method="libcurl"))
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다