2017-12-11 11 views
1

문자열 파싱을 알아 내려고 노력했지만 내 머리 위로 들여다 보입니다. 이에 (내가 종의 이름은 여기에서 발생하는 것으로 나타났습니다문자열을 eBRD 웹 사이트에서 r

url <- 'http://ebird.org/ebird/country/CR?yr=all' 
doc <- htmlParse(rawToChar(GET(url)$content)) 
string <- as(doc, "character") 

: 나는이 같은 무언가가 나의 최종 제품은 지금까지 this webpage. 에서은 "종 이름"열의 문자 벡터가되고 싶어요 경우) 스톰 - 제비 화이트 배가 :

<td headers="s" class="species-name">White-bellied Storm-Petrel</td> 

가 어떻게리스트로 이들 모두를 끌어 수집 할 수 있는가?

답변

1

우리는이 완벽 rvest

library(rvest) 
species <- read_html(url) %>% 
       html_nodes('td.species-name') %>% 
       html_text 
head(species) 
#[1] "Common Pauraque"   "Roadside Hawk"    "Inca Dove" 
#[4] "Common Ground-Dove"  "White-winged Dove"   
#[6] "Rufous-tailed Hummingbird" 
+1

하여이 작업을 수행 할 수 있습니다! 고맙습니다! – Heliornis