Skip to content

Instantly share code, notes, and snippets.

View mcguinlu's full-sized avatar

Luke McGuinness mcguinlu

View GitHub Profile

This is a test of pinning gists

@mcguinlu
mcguinlu / medRxiv_scraper.R
Created September 30, 2019 10:00
Script to download the PDF of each result of a search on medRxiv
library(stringr)
library(rvest)
# Remember to edit the link to display all search results on a single page
# Save results page as html file and then read it in.
# Robots.txt disallows scraping of search/ paths, so this approach is a hacky fix
# Robots.txt has no problem with scraping content/ paths
h <- read_html("../../Downloads/medRxiv_test.html")
library(tidyr)
# Prep RAYYAN extract for ML ----------------------------------------------
test <- read.csv("articles.csv")
# Remove day/month
test <- test[,c(1:3,6:17)]
test$notes <- gsub("RAYYAN", "| RAYYAN", test$notes)
@mcguinlu
mcguinlu / trends
Created December 10, 2019 12:05 — forked from dsquintana/trends
A script for visualising research trends
# install.packages("rvest")
library(rvest)
# DEFINE WEBPAGE BASE ADDRESS #
url <- "https://www.medrxiv.org/"
# OPEN BASE ADDRESS #
browseURL(url)
library(robvis)
library(ggplot2)
#Define colours (cochrane)
low_colour <- "#02C100"
concerns_colour <- "#E2DF07"
high_colour <- "#BF0000"
critical_colour <- "#820000"
ni_colour <- "#4EA1F7"
# SET-UP ------------------------------------------------------------------
# Install and load the package
devtools::install_github("mcguinlu/medrxivr")
library(medrxivr)
# PART 1 ------------------------------------------------------------------
# Read in the data you downloaded from the web-app
@mcguinlu
mcguinlu / get_common_authors.R
Last active April 9, 2020 14:55
Script to find references linked by common authorship in a .bib file
library(bib2df)
library(dplyr)
get_common_authors <- function(data){
data$related <- character(dim(data)[1])
for (test.row in 1:dim(data)[1]) {
library(dplyr)
library(medrxivr)
# Create bx_api_content
# Modified version of mx_api_content()
bx_api_content <- function(from.date = "2013-01-01",
to.date = Sys.Date(),
clean = TRUE,
include.info = FALSE) {
# packages needed
library(gridExtra)
library(tidyverse)
library(patchwork)
# this table uses Fira Sans font - this will need to be installed
# https://fonts.google.com/specimen/Fira+Sans
library(extrafont)