Skip to content

Instantly share code, notes, and snippets.


Zhian N. Kamvar zkamvar

View GitHub Profile
zkamvar / renv.lock
Created Dec 15, 2021
renv.lock file from failing repo
View renv.lock
"R": {
"Version": "4.1.0",
"Repositories": [
"Name": "carpentries",
"URL": ""
"Name": "carpentries_archive",

Keybase proof

I hereby claim:

  • I am zkamvar on github.
  • I am zkamvar ( on keybase.
  • I have a public key ASDqVco4Xm3D5M11ckLrYgE9XyqlHFxA7MwqWszJxWvmSAo

To claim this, I am signing this object:

zkamvar / subLoc.R
Last active Apr 10, 2021
Function for subsetting loci in a genind object by name
View subLoc.R
#' Subset loci in a genind object by name
#' @param dat a genind object
#' @param ... names of the loci in character format OR numeric indices of the loci.
#' @return the appropriate names to use for subsetting in a genind object
#' @examples
#' library(adegenet)
#' data(nancycats)
#' # Old way:
zkamvar /
Last active Aug 18, 2020
pandoc markdown_github with section-divs booboo

This compares the differences between pandoc's markdown and markdown_github engines when parsing <div> tags within sections.


In essence, if a <div> tag contains a header out of order with the main document, its contents will be appended to the div in the html document with markdown_github. If the following div appears after a level 3 header:

<div class='boo'>

## level 2
View tink.R
# test file
sample_chunk <- "
```{r hello, testing=as.logical(1), another=1 + 1}
x <- 1 + 1 # this evaluates to two
the value of x is `r x`"
file = "sample.Rmd"
writeLines(sample_chunk, con = file)
# delete temp Rmd file
zkamvar / Makefile
Last active Mar 18, 2020
Example SLURM script that records memory, time, and job id
View Makefile
FILES := file1.out \
file2.out \
file3.out \
file4.out \
file5.out \
file6.out \
file7.out \
file8.out \
zkamvar / Makevars
Created Jul 14, 2015
My R Makevars file to ensure that I build R packages with openmp
View Makevars
# This file's location is ~/.R/Makevars
# Default variables (no omp support):
# CXX=clang++
# CC=clang
# I followed the instructions at to install gcc 4.9
# This script was created because I had a problem with inkscape not recognizing
# fonts generated by R's pdf generator. This will go through and make these fonts
# scaleable.
# Workflow: Generate PDF > open in inkscape > save as svg > run this script
# Usage: perl -i <my_file.svg>
zkamvar /
Last active Jun 17, 2019
Command prompt functions to go in .bashrc or .bash_profile that will color the command line if there is a git repository.
zkamvar / render-demo.R
Last active Aug 23, 2018
Render an R demo
View render-demo.R
#!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = TRUE)
if (length(args) != 2) {
msg <- "
render-demo.R <demo> <package>
This utility will render the code and figures from a given package as a PDF
and place them into a directory called `<demo>-generated_files`. This requires
knitr, rmarkdown and LaTeX to be installed on your system.