Skip to content

Instantly share code, notes, and snippets.

View sebastiansauer's full-sized avatar
🇺🇦
🇺🇦

Sebastian Sauer sebastiansauer

🇺🇦
🇺🇦
View GitHub Profile
@briandk
briandk / rmarkdown.yml
Created March 21, 2016 01:31
Default YAML block for RMarkdown Manuscripts
title: "[Title Goes Here]"
author: "[Blinded for Review]"
documentclass: "article"
output:
pdf_document:
keep_tex: true
number_sections: true
highlight: "tango"
toc: true
md_extensions: +implicit_figures +grid_tables +fenced_code_blocks +fenced_code_attributes
@briandk
briandk / generate_package_citations.R
Created April 9, 2017 18:21
Wil Doane's system for automatically generating bibliography entries for the R packages you're using
# Early in the script
pkgs_pre_script <- try(devtools::loaded_packages(), silent = TRUE)
# Late in the script
pkgs_used_during_script <- try(devtools::loaded_packages(), silent = TRUE)
cat("* ")
print(citation(), style="text") # or Bibtex or LaTeX
# data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat
# Originally seen at http://spatial.ly/2014/08/population-lines/
# So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess,
# and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after
# @hadleywickham pointed that out. Also, switched from geom_segment to geom_line.
# The result of the code below can be seen at http://imgur.com/ob8c8ph
library(tidyverse)
@DarwinAwardWinner
DarwinAwardWinner / analyze_pkg_usage.R
Last active July 8, 2023 10:08
Script for finding loaded but unused packages in R scripts
#!/usr/bin/env Rscript
suppressPackageStartupMessages({
library(globals)
library(readr)
library(stringr)
library(rex)
library(magrittr)
library(rlang)
library(knitr)
@acoppock
acoppock / gelman_and_hill_chapter_3.R
Created September 16, 2018 14:33
Gelman and Hill Chapter 3 Using ggplot and estimatr
# Gelman and Hill 2007: Chapter 3 Regression Examples
# Using ggplot and estimatr
rm(list = ls())
# Uncomment to install
# install.packages("ggplot2")
# install.packges("haven")
# install.pacakges("estimatr")
library(ggplot2)
@krassowski
krassowski / example_font_awesome.R
Created March 17, 2022 18:06
ggplot geom_font_awesome
library(ggplot2)
source('geom_font_awesome.R')
shapes_map = c(
setosa = 'car',
virginica = 'ban',
versicolor = 'star'
)
(