R 刮取数据时包含两个倍数
希望从中获取天气数据 从2019-01-01一直到今天,我还不知道如何编写代码,将jaar=2019(即年份=2019)、maand=1(即月份=1)和dag=1(即日期=1)更改为所需的天数 我试着与lapply合作:R 刮取数据时包含两个倍数,r,web-scraping,R,Web Scraping,希望从中获取天气数据 从2019-01-01一直到今天,我还不知道如何编写代码,将jaar=2019(即年份=2019)、maand=1(即月份=1)和dag=1(即日期=1)更改为所需的天数 我试着与lapply合作: years <- c("2019", "2020") urls <- rbindlist(lapply(years, function(x) { url <- paste(https://www.wetterzentrale.d
years <- c("2019", "2020")
urls <- rbindlist(lapply(years, function(x) {
url <- paste(https://www.wetterzentrale.de/weatherdata.php?station=260&jaar=2019&maand=1&dag=1, sep = "")
data.frame(url)
} ))
yearslibrary(lubridate)
所有的日期
library(lubridate)
allYourDates <- seq(ymd(20190101), Sys.Date(), by = "days")
urls <- paste("https://www.wetterzentrale.de/weatherdata.php?station=260&jaar=", year(allYourDates)
, "&maand=", month(allYourDates)
, "&dag=", day(allYourDates)
, sep = "")