Skip to content

Instantly share code, notes, and snippets.

@mathieubray
mathieubray / TensorKPD.R
Created Aug 4, 2017
Tensor Decompositions as applied to Simulated KPD Data
View TensorKPD.R
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
@mathieubray
mathieubray / KPD.R
Created Jul 18, 2017
Worked Example for Kidney Paired-Donation
View KPD.R
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 / MendeleyExtractor.R
Last active Jun 16, 2020
Extract Mendeley Notes Using R
View MendeleyExtractor.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