Skip to content

Instantly share code, notes, and snippets.

@MichaelChirico
Last active March 14, 2016 21:10
Show Gist options
  • Save MichaelChirico/454f92105574249a1773 to your computer and use it in GitHub Desktop.
Save MichaelChirico/454f92105574249a1773 to your computer and use it in GitHub Desktop.
library(data.table)
URL <- paste0("https://gist.githubusercontent.com/MichaelChirico/",
"67d8dcec64ea6cb7caf2/raw/22f7eb750c1ba8175463ae48901285934a5dadf8/annual.csv")
annual <- fread(URL)
annual.m <-
melt(annual, id.vars = "year"
)[ , paste0("V", 1:3) :=
tstrsplit(variable, "_")
][ , paste0("V1.", 1:2) :=
tstrsplit(V1, "(?<=r)", perl = TRUE)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment