Skip to content

Instantly share code, notes, and snippets.

@pengelbrecht
Created October 7, 2013 13:49
Show Gist options
  • Save pengelbrecht/6868330 to your computer and use it in GitHub Desktop.
Save pengelbrecht/6868330 to your computer and use it in GitHub Desktop.
# Now read the district ownership list and merge into the total list
require(RCurl)
myCsv = getURL("https://docs.google.com/spreadsheet/pub?key=0AtqalGIOYWlYdHdjbHQ3MmNLODZXdXVuaUVENkZCYlE&single=true&gid=1&range=A1%3AB233&output=csv")
districtowner = read.csv(textConnection(myCsv))
colnames(districtowner) = c("Distrikt", "Seller")
nn = merge(nn, districtowner, by.x = 16, by.y = 1)
sellers = as.character(unique(nn$Seller))
for(i in 1:length(sellers)) {
seller = sellers[i]
liste = nn[nn$Seller==seller,]
write.csv2(liste, file = paste("sellers/", seller, ".csv", sep=""),row.names=FALSE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment