Skip to content

Instantly share code, notes, and snippets.

Noam Ross noamross

Block or report user

Report or block noamross

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
noamross / partition.R
Last active Jan 21, 2020
A quick greedy algorithm to partition unequal-sized groups into near-equal shards
View partition.R
#' Function to partition unequal sized groups into shards of similar size.
#' Based on the greedy algorithm described in [The Wikipedia article on the
#' the partitioning problem](
#' @param groups_vector An integer vector of group ids, such as a group ID
#' column in a data frame
#' @param n_shards The number of shards to split groups up into
#' @examples
#' n_groups <- 200

Keybase proof

I hereby claim:

  • I am noamross on github.
  • I am noamross ( on keybase.
  • I have a public key ASB-BxfY2ry-bqcNtfdHGtsrS2Xwb0kBX2i_fgE1znBsSQo

To claim this, I am signing this object:

noamross / test.Rmd
Last active Apr 3, 2019
flexdashboard/shiny tests
View test.Rmd
title: "test"
orientation: rows
runtime: shiny
```{r setup, include = FALSE}
noamross / criticmarkup.lua
Last active Feb 11, 2020
A pandoc filter for MS Word track changes to criticmarkup
View criticmarkup.lua
-- a lua filter for panodoc
-- run pandoc your_word_doc.docx --track-change=all -t markdown --lua-filter=criticmarkup.lua
-- TODO: Detect substitutions in adjacent insertion/deletions
-- TODO: capture whole comment hightlight rather than just start point of comment
function Span(elem)
if elem.classes[1] and elem.classes[1] == "insertion" then
local opener = { pandoc.RawInline(FORMAT, "{++ ") }
local closer = { pandoc.RawInline(FORMAT, " ++}") }
return opener .. elem.content .. closer
noamross / test.Rmd
Last active Oct 27, 2018
View test.Rmd
title: "Test RVG pptx"
keep_md: TRUE
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
noamross / mgcv-posterior-animate.R
Created Sep 2, 2018
Animating smoothing uncertainty in a GAM
View mgcv-posterior-animate.R
# Fit a GAM to the data
mod <- gam(hp ~ s(mpg), data=mtcars, method="REML")
# Get the linear prediction matrix
newdat = data.frame(
noamross /
Last active Aug 30, 2018
An experiment in trying to make RStudio GIT_EDITOR for terminal sessions
# Put this file somewhere and run
# export EDITOR=/path/to/
# export GIT_EDITOR=/path/to/
# There's probably some way to set thes e in my profile to only run
# when RSTUDIO=1
### Set initial time of file
LTIME=`stat -f "%m" $1`
noamross / put64.R
Last active Jun 14, 2018
Simple R object to base64 conversion. Free to a good home in your R package! If you put it in your package, let me know 🙂
View put64.R
# Copyright 2018 Noam Ross
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
View hrbrfear.R
library(rtweet) #rtweet API creds should already be set up
hbt <- get_timeline("hrbrmstr", n=3200)
hbt2 <- hbt %>%
noamross / angryscrape.R
Last active Apr 2, 2018
In which I scrape WAHIS out of rage
View angryscrape.R
# Pretend we are a browser
my_headers = c(Origin="",
`User-Agent`="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
You can’t perform that action at this time.