Skip to content

Instantly share code, notes, and snippets.

@mdlincoln
mdlincoln / row_rep.R
Created November 6, 2015 04:45
dplyr-friendly verb: replicate the rows of a data_frame n times
row_rep <- function(df, n) {
df[rep(1:nrow(df), times = n),]
}
@jennybc
jennybc / reverse-categorical-axis-ggplot2.r
Created October 10, 2014 01:06
Reverse the order of a categorical axis in ggplot2
scale_x_discrete(limits = rev(levels(the_factor)))