【发布时间】:2016-10-21 03:34:16
【问题描述】:
我想从以下网站下载一个月内所有日子的天气数据:
https://www.wunderground.com/history/airport/KSEA/2013/1/8/DailyHistory.html?format=1
我意识到这可以通过更改上述网络链接中的日期来完成。例如,1 月 9 日的链接将是
...KSEA/2013/1/9/DailyHistory.html?format=1
因此,当我单独下载这些数据时,我能够获取 csv 文件,但是当我尝试为整个月编写 for 循环时,它只是无法正常工作。以下是我用于单个文件下载的代码:
download.file(url = 'https://www.wunderground.com/history/airport/KSEA/2013/1/8/DailyHistory.html?MR=1&format=1',
destfile = "/Users/ABCD/Desktop/weather.csv")
任何帮助将不胜感激。
【问题讨论】:
-
“我的 X 有问题,这是我的 Y 代码。”您能否请edit您的问题包括不起作用的for循环?
-
您是否查看过
weatherData包。这可能会让事情变得容易一些。
标签: r loops date export-to-csv