Skip to content

Instantly share code, notes, and snippets.

View mattsigal's full-sized avatar

Matthew Sigal mattsigal

View GitHub Profile
@mrdwab
mrdwab / stratified.R
Last active April 27, 2024 19:57
Stratified random sampling from a `data.frame` in R
stratified <- function(df, group, size, select = NULL,
replace = FALSE, bothSets = FALSE) {
if (is.null(select)) {
df <- df
} else {
if (is.null(names(select))) stop("'select' must be a named list")
if (!all(names(select) %in% names(df)))
stop("Please verify your 'select' argument")
temp <- sapply(names(select),
function(x) df[[x]] %in% select[[x]])
@friendly
friendly / migrate-svn-git.md
Last active September 18, 2017 21:00
Migration path for R packages from svn/R-Forge to git/github

Migrating SVN/R-Forge packages to git/github

Migration \Mi*gra"tion, n. [L. migratio: cf. F. migration]

1: The movement of persons or groups from one country or locality to another.

2: The passage of software developers from one platform, language or environment to another for the purpose of feeding, breeding or enhanced health of their offspring.

Context

@benmarwick
benmarwick / sparkbars_in_Rmd.R
Last active June 13, 2017 09:13
sparkbars in R Markdown
---
output: html_document
---
```{r, fig.show='hide', include=FALSE}
library(colformat)
x1 <- c("Using R Markdown and the colformats package we can put a sparkbar in
line with the text using inline R code, like this `` `r '\x60r spark_bar(x)\x60'` ``.
Here's a sparkbar showing a histogram of the number of characters
in each word in this text: `r spark_bar(x2)`. And here is a sparkbar
@48klocs
48klocs / voltron.txt
Last active October 27, 2021 20:36
48klocs gigant0r #dimwishlists dump file
This file has been truncated, but you can view the full file.
// Mercules' Erentil FR4 breakdown
// https://www.reddit.com/r/DestinyTheGame/comments/cbxao7/massive_breakdown_of_erentil_fr4_including_stats/
// Erentil FR4
dimwishlist:item=3027844941&perks=194952923,3868766766,280464955,1600092898
dimwishlist:item=3027844941&perks=194952922,3868766766,280464955,1600092898
dimwishlist:item=3027844941&perks=194952923,2969185026,280464955,1600092898
dimwishlist:item=3027844941&perks=194952922,2969185026,280464955,1600092898
dimwishlist:item=3027844941&perks=194952923,3868766766,1645158859,1600092898
dimwishlist:item=3027844941&perks=194952922,3868766766,1645158859,1600092898