Skip to content

Instantly share code, notes, and snippets.

View jtr13's full-sized avatar

Joyce Robbins jtr13

  • Columbia University
  • New York, NY
  • 20:09 (UTC -04:00)
  • X @jtrnyc
View GitHub Profile
@jimhester
jimhester / create_flashcards.R
Last active May 20, 2018 13:23
Create flash cards of rOpenSci unconf participants. You can get the shared deck from https://ankiweb.net/shared/info/806702790 or by importing the 'unconf 2018.apkg' file in this gist
# On macOS Anki media files are stored in ~/Library/Application Support/Anki2/Username/collection.media/
# https://apps.ankiweb.net/docs/manual.html#file-locations
# get images from Unconf repo, resize them and write them to the new path
# Code assumes it is being run on macOS from the checkout of the conference repo, e.g. `git clone https://github.com/ropensci/unconf18 && cd unconf18`
library(fs)
library(magick)
imgs <- dir_ls("images/participants")
for (f in imgs) {
f %>%
image_read() %>%
@docsteveharris
docsteveharris / ggMMplot.R
Last active February 16, 2017 16:04
Mosaic plot using ggplot
#' @title Mosaic plot using ggplot.
#'
#' @description
#' Creates a mosaic plot where the dimensions of the cells of a
#' confusion matrix represent their marginal proportions.
#'
#' @details
#' Credit for initial iteration to
#' [Edwin](http://stackoverflow.com/a/19258045/992999)
#' This version adds color brewer options and tidies the labelling
@aronatkins
aronatkins / install-rstudio-daily.sh
Last active February 10, 2022 08:54
Install RStudio daily build on OSX/macOS or Ubuntu Linux
#!/bin/bash
#
# Installs the latest RStudio daily desktop build for OSX/macOS and Ubuntu(amd64)
#
# https://support.rstudio.com/hc/en-us/articles/203842428-Getting-the-newest-RStudio-builds
set -e
install_macos_daily() {
REDIRECT_URL="https://www.rstudio.org/download/latest/daily/desktop/mac/RStudio-latest.dmg"
@Pakillo
Pakillo / Rmarkdown-fontsize.Rmd
Created January 22, 2015 22:32
Changing font sizes of HTML ouput in Rmarkdown
---
title: "Untitled"
author: "Francisco Rodriguez-Sanchez"
date: "Thursday, January 22, 2015"
output: html_document
---
<style type="text/css">
body, td {
@jennybc
jennybc / 2014-10-12_stop-working-directory-insanity.md
Last active September 23, 2022 04:43
Stop the working directory insanity

There are packages for this now!

2017-08-03: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:

  • rprojroot: This is the main package with functions to help you express paths in a way that will "just work" when developing interactively in an RStudio Project and when you render your file.
  • here: A lightweight wrapper around rprojroot that anticipates the most likely scenario: you want to write paths relative to the top-level directory, defined as an RStudio project or Git repo. TRY THIS FIRST.

I love these packages so much I wrote an ode to here.

I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆

@pimentel
pimentel / head.list.R
Last active June 27, 2018 03:09
Slightly more sane head() for lists in R
catDf <- data.frame(meow = rnorm(100), purr = rpois(100, 3))
aList <- list(aVector = 1:20, aDf = catDf, anotherList = list(1:200, 1:20))
# annoying as hell, right?
head(aList)
#' Return the first or last part of a list
#'
#' Returns the first or last part of a list. Instead of returning the first
#' n entries as the standard head() does, it attempts to call head()
@jrnold
jrnold / gist:6799152
Last active August 18, 2021 13:44
Create a plot of the normal distribution with an area shaded in. Useful for teaching z-scores and stuff like that.
library("ggplot2")
#' Draw Normal Distribution Density with an area shaded in.
#'
#' @param lb Lower bound of the shaded area. Use \code{-Inf} for a left tail.
#' @param ub Upper bound of the shaded area. Use \code{Inf} for a right tail.
#' @param mean Mean of the normal distribution
#' @param sd Standard deviation of the normal distribution
#' @param limits Lower and upper bounds on the x-axis of the area displayed.
#' @return ggplot object.
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code