Skip to content

Instantly share code, notes, and snippets.

@achateigner
achateigner / ipak.R
Last active August 29, 2017 12:22 — forked from stevenworthington/ipak.R
Install and load multiple R packages at once
ipak <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE)
# if install fails, try bioconductor
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg)){
if (! any(grep("BiocInstaller", search()))){
source("https://bioconductor.org/biocLite.R")
library(BiocInstaller)
@achateigner
achateigner / ipak.R
Created August 29, 2017 12:20 — forked from stevenworthington/ipak.R
Install and load multiple R packages at once
# ipak function: install and load multiple R packages.
# check to see if packages are installed. Install them if they are not, then load them into the R session.
ipak <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE)
sapply(pkg, require, character.only = TRUE)
}
@achateigner
achateigner / captions_and_crossrefs.rmd
Created April 21, 2017 09:26 — forked from benmarwick/captions_and_crossrefs.rmd
Auto-numbering and cross-referencing of figures and tables in rmarkdown
---
title: "Auto-numbering and cross-referencing of figures and tables in rmarkdown"
output: html_document
---
TODO: check this out: https://github.com/adletaw/captioner
Here's how to use:
1. Copy and paste the first two code chunks in this document to the top of your document