尝试从 URL 下载 ZIP 文件时出错

Errors when trying to download ZIP file from URL

我正在尝试在 R 中下载 ZIP 文件并提取 CSV。 我在 Whosebug 上找到了几个解决方案,例如 Using R to Download and extract zip file that contains a folder,

但我收到错误消息。 我的代码:

url <- 'https://www.intervista.ch/media/2020/03/Download_Mobilit%C3%A4ts-Monitoring_Covid-19.zip'

temp <- tempfile()
download.file(url,temp)

错误输出(翻译自德语):

download.file(url, temp) 错误: 无法打开 URL 'https://www.intervista.ch/media/2020/03/Download_Mobilit%C3%A4ts-Monitoring_Covid-19.zip' 附加警告: 在 download.file(url, temp) 中: URL 'https://www.intervista.ch/media/2020/03/Download_Mobilit%C3%A4ts-Monitoring_Covid-19.zip':状态为 'SSL peer certificate or SSH remote key was not OK'

您似乎遇到了 SSL 问题,通常是 curl 问题 - Get site content over SSL with httr in R:可能会尝试遵循这些建议的解决方案,因为以下代码对我有用:

Modalsplit <- read.csv(unz(temp, "Modalsplit_pro_Tag.csv"))
Mittelwerte <- read.csv(unz(temp, "Mittelwerte_und_Median_pro_Tag.csv"))
Distanz <-read.csv(unz(temp, "Mittelwerte_und_Median_pro_Tag.csv"))