Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 网络刮擦同义词_R_Web Scraping_Purrr_Rvest - Fatal编程技术网

R 网络刮擦同义词

R 网络刮擦同义词,r,web-scraping,purrr,rvest,R,Web Scraping,Purrr,Rvest,我正试图从美国国家癌症研究所同义词数据库中提取同义词,但是我在找到正确的html时遇到了一些困难。下面是我的代码和我正在使用的数据帧。当我运行脚本提取同义词时,open.connection(x,“rb”):HTTP错误404中出现了一个错误。我似乎无法确定正确的html链接应该是什么以及如何找到它 库(xml2) 图书馆(rvest) 图书馆(dplyr) 图书馆(tidyverse) 同义词我怀疑这行代码有问题: ##Designate html like and the values t

我正试图从美国国家癌症研究所同义词数据库中提取同义词,但是我在找到正确的html时遇到了一些困难。下面是我的代码和我正在使用的数据帧。当我运行脚本提取同义词时,open.connection(x,“rb”):HTTP错误404中出现了一个
错误。
我似乎无法确定正确的html链接应该是什么以及如何找到它

库(xml2)
图书馆(rvest)
图书馆(dplyr)
图书馆(tidyverse)

同义词我怀疑这行代码有问题:

##Designate html like and the values to search 
htmls <- paste0("https://ncit.nci.nih.gov/ncitbrowser/pages/concept_details.jsf/", words)
虽然我对
rvest
没有特别的经验,但您看到的404错误几乎肯定与web浏览器无法加载这些URL有关。我建议您登录或打印出
htmls
,这样您就可以确认它们在web浏览器中确实工作正常


我要指出的是,在这种特殊情况下,网站提供:;你可能会发现离线下载和查询要比抓取网页更容易。

事实上,忽略这一点,我想我误解了你的问题。我将尝试一个正确的答案。
##Designate html like and the values to search 
htmls <- paste0("https://ncit.nci.nih.gov/ncitbrowser/pages/concept_details.jsf/", words)
https://ncit.nci.nih.gov/ncitbrowser/pages/concept_details.jsf/Ketamine
https://ncit.nci.nih.gov/ncitbrowser/pages/concept_details.jsf/Azacitidine
https://ncit.nci.nih.gov/ncitbrowser/pages/concept_details.jsf/Axicabtagene+Ciloleucel