Skip to content

Instantly share code, notes, and snippets.

@mcguinlu
Created January 15, 2020 12:20
Show Gist options
  • Save mcguinlu/98a5ebac786f5ab2123587f2673eb010 to your computer and use it in GitHub Desktop.
Save mcguinlu/98a5ebac786f5ab2123587f2673eb010 to your computer and use it in GitHub Desktop.
# install.packages("rvest")
library(rvest)
# DEFINE WEBPAGE BASE ADDRESS #
url <- "https://www.medrxiv.org/"
# OPEN BASE ADDRESS #
browseURL(url)
# OPEN WEBPAGE VIRTUALLY #
page <- read_html(url)
# GET INFORMATION FROM PAGE #
text <- page %>%
html_node(".view-by-month-link") %>%
html_text('')
path <- page %>%
html_nodes(".view-by-month-link") %>%
html_attr('href')
# CREATE NEW LINK BY ADDING THE PATH TO THE BASE ADDRESS #
new.url <- paste0("https://www.medrxiv.org/",path)
# OPEN NEW LINK #
browseURL(new.url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment