Skip to content

Instantly share code, notes, and snippets.

View zkamvar's full-sized avatar
On Sabbatical

Zhian N. Kamvar zkamvar

On Sabbatical
View GitHub Profile
zkamvar / poppr_patches.R
Last active August 29, 2015 14:10
Script to fix any bugs that occur in the R code in poppr. This unfortunately does not fix bugs that occur in the C code.
# UPDATED: 2015-07-17
# with devtools - devtools::source_gist("b64078a0d04d2452c905")
# downloaded - source("poppr_patches.R")
# Fix read.genalex ( see: )
zkamvar /
Last active August 29, 2015 14:20
r-devel docker to test poppr

Notes for working with docker to test poppr on R-devel

I recently got an email from Kurt Hornik from CRAN stating that a single line of code was causing poppr to fail in R-devel. Since installing R-devel is a pain on OSX, I decided to use a docker container. Ted Hart has a good blog on it here.

On mac, I followed the instructions to install docker starting here.

I ran this once and have never had to run it again:

hrbrmstr /
Last active August 29, 2015 14:26
A small script to grab the latest RStudio daily build for OS X and install it.


  • Added instructions for loading job with launchctl
  • Fixed issue in vol=${atch##* }
zkamvar / lazierLoad.R
Last active September 11, 2015 16:22
Does a lazy load across all files when provided a knitr cache directory.
#' Performs lazy load on a directory
#' @param path a filepath containing the necessary files for lazy loading
#' @return NULL
#' @details This function will go into a directory, search for all the files
#' that seem like they can be lazily loaded and attempt to load them.
lazierLoad <- function(path){
files <- dir(path)
yihui /
Last active March 15, 2017 18:35
A Shiny app based on annyang that responds to voice input
jennybc / 2014-11-18_install-github-tmp-lib.r
Last active November 17, 2017 12:50
Install a package from, e.g., GitHub into a temporary library
## 2015-11-11 NOTE!
## with_libpaths() is one of the functions removed (well, deprecated, for now) from
## devtools
## it's in withr now!
## see newer script below!!!
library(devtools) # with_lib(), install_github()
tmp_lib <- "~/tmp/tmp_lib"
mlund /
Last active March 25, 2018 23:31
Convert Digital Object Identifier (DOI) to BibTeX using
curl -LH "Accept: application/x-bibtex;q=1"$1
joshkatz / sotu.R
Created January 31, 2018 15:49
State of the Union WPM chart
needs(rvest, tidyverse, zoo)
df <- c('minutes', 'words') %>%
map(function(var) {
doc <- var %>%
sprintf(fmt = '') %>%
doc %>%
html_node('table tr:nth-of-type(2) table') %>%
html_table(fill = T) %>%
<!doctype html>
<!-- This is just a very slightly modified tracking.js demo: -->
<meta charset="utf-8">
<script src=""></script>
<script src=""></script>
video, canvas {
margin-left: 100px;
brodieG / cran-check.R
Last active June 18, 2019 21:02
Check CRAN Results
# started with `foghorn`, but that comes with dependencies and
# slows down R startup. `browseURL` just barely slows startup,
# even if actual page is slow to load.
check_cran_old <- function(email) {
gsub("[^A-Za-z0-9_:.-]", "_", sub("@", "_at_", email))
) ) }