Skip to content

Instantly share code, notes, and snippets.

View zkamvar's full-sized avatar
🍄
has jerb

Zhian N. Kamvar zkamvar

🍄
has jerb
View GitHub Profile
@zkamvar
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
#
# USAGE/INSTALLATION:
# with devtools - devtools::source_gist("b64078a0d04d2452c905")
# downloaded - source("poppr_patches.R")
#
# UPDATES:
# Fix read.genalex ( see: https://github.com/grunwaldlab/poppr/issues/58 )
#
@zkamvar
zkamvar / rdevdocker.md
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
hrbrmstr / CHANGELOG.md
Last active August 29, 2015 14:26
A small script to grab the latest RStudio daily build for OS X and install it.

2015-07-29

  • Added instructions for loading job with launchctl
  • Fixed issue in vol=${atch##* }
@zkamvar
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
yihui / README.md
Last active March 15, 2017 18:35
A Shiny app based on annyang that responds to voice input
@jennybc
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"
dir.create(tmp_lib)
@mlund
mlund / doi2bib.sh
Last active March 25, 2018 23:31
Convert Digital Object Identifier (DOI) to BibTeX using crosscite.org
#!/bin/bash
curl -LH "Accept: application/x-bibtex;q=1" http://dx.doi.org/$1
echo
@joshkatz
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 = 'http://www.presidency.ucsb.edu/sou_%s.php') %>%
read_html()
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: https://trackingjs.com/examples/face_camera.html -->
<html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/tracking.js/1.1.3/tracking-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tracking.js/1.1.3/data/face-min.js"></script>
<style>
video, canvas {
margin-left: 100px;
@brodieG
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) {
utils::browseURL(
sprintf(
"https://cran.r-project.org/web/checks/check_results_%s.html",
gsub("[^A-Za-z0-9_:.-]", "_", sub("@", "_at_", email))
) ) }