Skip to content

Instantly share code, notes, and snippets.

@noamross
noamross / source_rmd.R
Last active December 13, 2023 18:52
Source an RMD file
#' Source the R code from an knitr file, optionally skipping plots
#'
#' @param file the knitr file to source
#' @param skip_plots whether to make plots. If TRUE (default) sets a null graphics device
#'
#' @return This function is called for its side effects
#' @export
source_rmd = function(file, skip_plots = TRUE) {
temp = tempfile(fileext=".R")
knitr::purl(file, output=temp)
@Junuxx
Junuxx / class_projects.py
Last active March 2, 2023 16:20
Solution for a StackOverflow scheduling problem
'''
Created on 26 jan. 2016
@author: Jeroen Kools
Based on the following StackOverflow question:
https://stackoverflow.com/questions/35002027/maximizing-a-combination-of-a-series-of-values#comment57732451_35002027
- 18 students
- 12 dates
@bl4ck5un
bl4ck5un / palatino.tex
Created September 26, 2015 02:04
Using Palatino font in LaTeX
\usepackage{tgpagella} % text only
\usepackage{mathpazo} % math & text
@jennybc
jennybc / reverse-categorical-axis-ggplot2.r
Created October 10, 2014 01:06
Reverse the order of a categorical axis in ggplot2
scale_x_discrete(limits = rev(levels(the_factor)))
@benmarwick
benmarwick / a-scientific-computing-environment-for-archaeology.txt
Last active May 14, 2018 19:32
Scientific Computing Environment for archaeology: Installing R, Rstudio and other things on a lightweight Linux in a VirtualBox virtual machine
Short instructions to setup a Lubuntu Virtual Machine with
R & RStudio:
1. Download these:
http://lubuntu.net/ (Intel x86 desktop cd)
https://www.virtualbox.org/wiki/Downloads (Oracle VM VirtualBox)
2. Install Oracle VM VirtualBox, open it (if using windows,
run as administrator), click 'New' button, at
'Name' put Lubuntu, 'Type' choose Linux, 'Version' choose