Skip to content

Instantly share code, notes, and snippets.

@aammd
Created November 23, 2015 19:31
Show Gist options
  • Save aammd/52b7f7bc02d7ee63be7d to your computer and use it in GitHub Desktop.
Save aammd/52b7f7bc02d7ee63be7d to your computer and use it in GitHub Desktop.
quick idea for getting country publication info
library(rvest)
library(magrittr)
pubs <- read_html("http://www.scimagojr.com/countryrank.php") %>%
html_node(".tabla_datos") %>%
html_table(row.names = FALSE)
library(tidyr)
library(dplyr)
extract_numeric
pubs<- pubs[,-(1:2)]
head(pubs)
names(pubs)[1] <- "Country"
apply(pubs, 2, function(x) gsub("\\.", "", x))
pubs %>%
group_by(Country) %>%
mutate_each(funs(extract_numeric))
str(pubs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment