Skip to content

Instantly share code, notes, and snippets.

@mathieubray
mathieubray / MendeleyExtractor.R
Last active June 16, 2020 19:08
Extract Mendeley Notes Using R
library(RSQLite) # Database
library(dplyr) # This really should be loaded by default always...
library(tidyr) # 'spread' function to change table from 'long' to 'wide' format
# Uncomment the following line with your Mendeley path.
# See here for more information: http://support.mendeley.com/customer/en/portal/articles/227951-how-do-i-locate-mendeley-desktop-database-files-on-my-computer-
# mendeley.path = "C:/Users/{username}/AppData/Local/Mendeley Ltd./Mendeley Desktop/{youremail}@{emailclient.com}@www.mendeley.com.sqlite"
# Connect to the database
@mathieubray
mathieubray / KPD.R
Created July 18, 2017 20:19
Worked Example for Kidney Paired-Donation
library(dplyr) # Take that, base R
library(purrr) # 'map' functions
library(igraph) # R graph framework
library(ggplot2) # For plotting
library(ggraph) # Plotting graphs
library(data.table) # 'rbindlist' to combine list of data frames into one data frame
library(ompr) # Mixed integer programming
library(ompr.roi)
library(ROI) # R optimization interface
@mathieubray
mathieubray / TensorKPD.R
Created August 4, 2017 12:57
Tensor Decompositions as applied to Simulated KPD Data
library(dplyr)
library(rTensor)
library(igraph)
library(sna)
library(ggplot2)
library(tidyr)
# Alpha NTF. Algorithm 1. Flatz 2013
# Input: Non-negative N-way tensor Y and rank J