coderLMN / AutomatedDataCollectionWithR

《基于 R 语言的自动化数据采集技术》读者讨论区
28 stars 10 forks source link

代码中存在的小问题 #5

Closed DataUSTC closed 8 years ago

DataUSTC commented 8 years ago

吴老师,你好 在阅读的过程中,发现一些小问题。 第244页,下载所有的新闻公告:

for (i in 1:length(all_links)) {
  url <- str_c("https://www.gov.uk",all_links[i])
  tmp <- getURL(url,cainfo = signatures)
  write(tmp, str_c("Press_Releases/", i, ".html"))
 }

直接运行会报错。后来解决方式是需要先建立相应的文件夹。

coderLMN commented 8 years ago

是的,要先在当前目录创建 Press_Releases 文件夹。这个代码调试的细节作者忽略了,谢谢提示!