https://genomebiology.biomedcentral.com/articles/10.1186/s13059-020-01975-8에 게시 된 기사에서 모든 콘텐츠를 가져 오려고합니다. 정보가 태그에 있음을 발견했습니다.
<article><div...><..> information.... <></article>
나는 다음과 같은 것을 시도하고 있습니다.
art_sections<-regexpr("<article (.*)?>(.[0-9]*)</article>",thepage)
하지만 정보를 검색 할 수는 없습니다 ..
어떻게 해결할 수 있는지 알고 싶습니다.
이것은 정규식 질문이 아니라 라이브러리를 사용하여 R을 사용한 웹 스크랩에 관한 것 rvest
입니다.
다음은 시작하는 데 도움이되는 몇 가지 샘플 코드와 몇 가지 링크 아래입니다.
#Loading the rvest package
library('rvest')
#Specifying the url for desired website to be scraped
url <- 'https://genomebiology.biomedcentral.com/articles/10.1186/s13059-020-01975-8'
#Reading the HTML code from the website
webpage <- read_html(url)
article_html <- html_nodes(webpage,'article')
#Converting the ranking data to text
html_text(article_html)
마지막으로 텍스트를 정리하려면 stringr
ie를 살펴보십시오.
library(stringr)
str_replace_all(x, "[\r\n]" , "")
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다