【发布时间】:2021-11-01 08:44:04
【问题描述】:
我正在尝试使用 riem 包从多个机场下载天气数据。我有当前下载单个机场的天气并将其保存为 station_METAR.csv 的代码,其中 station 是每个单独的城市。我希望每个城市都有单独的文件。我创建了另一个 CSV 文件,我将它带入名为“站”的环境中,并计划使用它的值来重复该过程。
我需要为每个单独的城市迭代这个下载和保存过程。
我不一定有一个特定的问题,因为我是 R 编码的新手,并且正在努力解决如何解决这个循环。提前感谢您的帮助!
x <- "KJFK"
start_date <- "2020-01-01"
end_date <- "2020-01-04"
#Download Station List
stations <- read_excel("~/Desktop/R WD/Reference Files/stations.xlsx",
col_names = FALSE)
#View(stations)
#Download Data
METAR <- riem_measures(station = x, date_start = start_date,date_end = end_date)
#Write a CSV file with the City Name
write.table(METAR, file=paste(x, "_METAR", sep=""))```
【问题讨论】: