Skip to content

Instantly share code, notes, and snippets.

@slarge
Created September 15, 2016 11:38
Show Gist options
  • Save slarge/4a41b9cdca5a184591425d62ece4b140 to your computer and use it in GitHub Desktop.
Save slarge/4a41b9cdca5a184591425d62ece4b140 to your computer and use it in GitHub Desktop.
library(dplyr)
tt <- read.csv("~/AreasEcoregionsStocks.csv",
stringsAsFactors = FALSE)
td <- tt %>%
select(StockCode, Ecoregion1_major, Ecoregion2_minor, Ecoregion3_more_minor) %>%
melt(id.vars = "StockCode") %>%
select(-variable) %>%
filter(value != 0) %>%
distinct()
write.csv(td, "~/git/StockCodeArea.csv", row.names = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment