Skip to content

Instantly share code, notes, and snippets.

@yannabraham
yannabraham / beanplots.R
Created July 16, 2012 09:31
ggplot2 BeanPlots
## reproduce the figures from http://www.jstatsoft.org/v28/c01/paper using ggplot2
library(ggplot2)
## parameters
set.seed(2710)
## Figure 1
d <- rnorm(50)
@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:

@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 2, 2024 05:49
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@jennybc
jennybc / twee-demo.Rmd
Last active August 14, 2022 21:50
twee(): emulating the tree directory listing command
---
title: "twee demo"
author: "Jenny Bryan"
date: "17 August, 2014"
output:
html_document:
toc: TRUE
keep_md: TRUE
---
@zross
zross / hooks.R
Last active November 28, 2018 02:59
Not completely finished hook to add fragment tags to RMarkdown code chunks (slidify, revealjs, R) v2
library(knitr)
opts_chunk$set(collapse=TRUE, echo=TRUE,
error=FALSE, message=FALSE,
warning=FALSE, cache=FALSE)
s0 <- knitr::knit_hooks$get('source')
o0 <- knitr::knit_hooks$get('output')
p0 <- knitr::knit_hooks$get('plot')
knitr::knit_hooks$set(
county sample state name exceedances
Mobile 20 al Dauphin Island Water & Sewer 1
Monroe 23 al Excel Water System 1
Washington 95 al Tate & Lyle Sucralose, Inc. Water System 1
Coosa 18.3 al Lake Mitchell Water, Incorporated 1
Juneau City and Borough 15.5 ak Thunder Mountain Mobile Park 1
Juneau City and Borough 31 ak Hecla Greens Creek Hawk Inlet 1
Ketchikan Gateway Borough 27.7 ak Boyer Towing 1
Ketchikan Gateway Borough 32.9 ak Thorne Bay, City Of 1
Ketchikan Gateway Borough 16.2 ak Clover Pass Christian School 2
@aschleg
aschleg / games_howell.R
Last active November 29, 2017 00:07
R function for performing Games-Howell Post-Hoc Test
games.howell <- function(grp, obs) {
#Create combinations
combs <- combn(unique(grp), 2)
# Statistics that will be used throughout the calculations:
# n = sample size of each group
# groups = number of groups in data
# Mean = means of each group sample
# std = variance of each group sample
@jeroen
jeroen / favicon.R
Last active February 14, 2019 21:32
Generate favicon with magick
library(magick)
library(magrittr)
# Convert to 'ico' format
image_read("https://www.r-project.org/logo/Rlogo.png") %>%
image_scale("32x32!") %>% # remove the "!" after 32x32 to scale proportionally
image_write("favicon.ico", format = "ico")
# Favicon can also be png/gif
@bearloga
bearloga / upgrade_packages.R
Last active October 8, 2020 12:46
The script can be used to re-install packages after upgrading R (on Linux or Mac), since libraries cannot be reused between different minor versions (e.g. when upgrading 3.2.3 to 3.3.2). It detects when a package was installed from CRAN vs GitHub/Git and re-installs it using the appropriate func. Usage: `Rscript upgrade_packages.R`
# WMF only:
if (file.exists("/etc/wikimedia-cluster")) {
message('Detected that this script is being run on a WMF machine ("', Sys.info()["nodename"], '"). Setting proxies...')
Sys.setenv("http_proxy" = "http://webproxy.eqiad.wmnet:8080")
Sys.setenv("https_proxy" = "http://webproxy.eqiad.wmnet:8080")
}
# General use:
message("Checking for a personal library...")
if (!dir.exists(Sys.getenv("R_LIBS_USER"))) {
@trestletech
trestletech / analysis.R
Last active July 7, 2017 16:49
Tidying of pressure-sensitive keystroke dynamics data. Raw available: https://figshare.com/articles/Pressure-sensitive_keystroke_dynamics_data/5170705 . The `isJA` column represents whether or not the user currently typing is "Jeffrey Allen" -- i.e. is the user typing his own name (TRUE) or someone else's (FALSE)?
download.file("https://ndownloader.figshare.com/articles/5170705/versions/1", "kd.zip")
unzip("kd.zip")
library(readr)
words <- readr::read_csv("KSP-Word.csv")
users <- readr::read_csv("KSP-User.csv")
entries <- readr::read_csv("KSP-Entry.csv")
keypress <- readr::read_csv("KSP-KeyPress.csv")
pressure <- readr::read_csv("KSP-Pressure.csv")