Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save josephsdavid/22d7a188faacef6c61068bb315b70286 to your computer and use it in GitHub Desktop.
Save josephsdavid/22d7a188faacef6c61068bb315b70286 to your computer and use it in GitHub Desktop.
library(rvest)
library(tidyverse)
# html scraper is a function of the url and the element of the list
html_scraper <- function(url, elem){
read_html(url) %>% html_nodes("table") %>% . [[elem]] %>% html_table -> out
return(out)
}
# usage
# html_scraper( 'http://pokemondb.net/pokedex/all' , 1 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment