Nice clean-up!!! On Tue, 2015-03-31 at 14:19 -0400, Ista Zahn wrote: > library(tidyr) > library(dplyr) > bw <- gather(bw, key = "tmp", value = "value", > matches("^d[a-z]+[0-9]+")) > bw <- separate(bw, tmp, c("disc", "var"), "_", extra = "merge") > bw <- spread(bw, var, value)