Skip to content

Instantly share code, notes, and snippets.

View kamermanpr's full-sized avatar

Peter Kamerman kamermanpr

View GitHub Profile
@kamermanpr
kamermanpr / RArticleNetwork.R
Created January 2, 2016 14:41 — forked from mbarnkob/RArticleNetwork.R
R code for generating a network of referring articles from pubmed. More info here: http://mikebarnkob.dk/2015/generating-an-article-network-using-rentrez-and-igraph-in-r/
#Article Network ver 2
#============================
# This program will scrape all citing articles surrounding one main article and
# create: 1) a list of most cited articles, 2) lists of main authors, 3) network of articles
# Mike Barnkob, December 28th 2015.
# www.mikebarnkob.dk
#Background and references
#1. https://cran.r-project.org/web/packages/rentrez/vignettes/rentrez_tutorial.html#advanced-counting
@kamermanpr
kamermanpr / proxyscript.sh
Last active April 14, 2021 06:00
Bash script to toggle proxy server settings for the terminal, git, and R based on network location setting (OSX)
#!/bin/bash
# By Peter Kamerman ([email protected])
##########
# FUNCTION
##########
# Script to toggle the proxy configurations of the terminal, git, and R
# for use behind a proxy server (e.g., at work) and no proxy (e.g., home).
########################
# DISCLAIMER and LICENSE
########################
@kamermanpr
kamermanpr / maxOSExtra_installs.sh
Last active June 22, 2017 14:57
Install xcode tools, homebrew, and git
#!/bin/bash
# I use this script after a clean install of macOS to re-install homebrew, git, and xcode tools.
## Install xcode tools
xcode-select --install
## Install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@kamermanpr
kamermanpr / confint_rlmerMod.R
Last active January 25, 2018 07:24
Wald confidence interval of robustlmm::rlmer beta coefficients
# Wald confidence interval of robustlmm::rlmer beta coefficients
# Adapted from code provided Ben Bolker on StackExchange: https://stats.stackexchange.com/questions/233800/how-can-i-get-confidence-intervals-for-fixed-effects-using-the-rlmer-function-r
confint.rlmerMod <- function(object, level = 0.95) {
# Extract beta coefficients
beta <- fixef(object)
@kamermanpr
kamermanpr / install-xcodeCLT-homebrew-git.md
Last active November 9, 2023 17:50
Install Xcode Command Line Tools, Homebrew, and Git on macOS

Install Xcode command line tools, Homebrew, and Git on macOS

Install the following apps on your mac running macOS:

  1. (standalone) Xcode Command Line Tools
  2. Homebrew
  3. Git

Modified from: https://www.moncefbelyamani.com

@kamermanpr
kamermanpr / compounding.R
Created January 15, 2019 14:02
Illustrating compound growth using absolute investment value, change from initial investment, and percentage change from initial investment.
############################################################
# #
# The effect of starting investment amount #
# on returns realised. The magic of compounding #
# #
############################################################
# Load packages
library(ggplot2)
@kamermanpr
kamermanpr / open_prescribing.R
Created June 29, 2020 12:05
Downloading gabapentinoid prescription data for England from openprescribing.net
#-- Load packages --#
library(readr)
#-- OpenPrescribing API details --#
# API details can be found here: https://openprescribing.net/api/
# Drug codes can be obtained here: https://openprescribing.net/analyse/
#-- Download pregabalin data --#
## Total items prescribed
total_pregabalin <- read_csv('https://openprescribing.net/api/1.0/spending/?code=0408010AE&format=csv')