POLAND[export] → ITALY 10,571,000BELGIUM[export] → NETHERLANDS 7,265,200BELGIUM[export] → FRANCE 5,898,900SPAIN[export] → ITALY 4,028,900BELGIUM[export] → ITALY 2,573,100FRANCE[export] → BELGIUM 2,387,100FRANCE[export] → ITALY 2,154,300NETHERLANDS[export] → FRANCE 2,102,500ROMANIA[export] → BULGARIA 1,870,800UNITED KINGDOM[export] → FRANCE 1,802,700LUXEMBOURG[export] → FRANCE 1,411,100NETHERLANDS[export] → BELGIUM 1,408,400ITALY[export] → HUNGARY 1,238,900ROMANIA[export] → BELGIUM 1,228,600IRELAND[export] → ITALY 1,172,500BELGIUM[export] → GERMANY 1,108,000ROMANIA[export] → ITALY 1,034,700NETHERLANDS[export] → ITALY 973,400ROMANIA[export] → POLAND 851,800BELGIUM[export] → FINLAND 832,800HUNGARY[export] → BULGARIA 827,200IRELAND[export] → BELGIUM 654,900NETHERLANDS[export] → FINLAND 615,100LITHUANIA[export] → ITALY 585,400IRELAND[export] → FRANCE 528,600ROMANIA[export] → NETHERLANDS 409,400ITALY[export] → NETHERLANDS 286,900BULGARIA[export] → ROMANIA 226,300ITALY[export] → BELGIUM 225,700BELGIUM[export] → SWEDEN 219,000BELGIUM[export] → CYPRUS 200,600GERMANY[export] → BELGIUM 191,200BELGIUM[export] → BULGARIA 181,900IRELAND[export] → UNITED KINGDOM 167,200UNITED KINGDOM[export] → BELGIUM 151,400DENMARK[export] → ITALY 137,100BELGIUM[export] → AUSTRIA 134,600UNITED KINGDOM[export] → POLAND 129,100BELGIUM[export] → LUXEMBOURG 113,700HUNGARY[export] → ESTONIA 110,900NETHERLANDS[export] → AUSTRIA 109,800HUNGARY[export] → LATVIA 108,300IRELAND[export] → GERMANY 95,800FRANCE[export] → UNITED KINGDOM 94,900ITALY[export] → AUSTRIA 93,800IRELAND[export] → NETHERLANDS 89,100FRANCE[export] → CYPRUS 84,800ITALY[export] → CZECH REPUBLIC 84,000DENMARK[export] → BELGIUM 79,500BELGIUM[export] → DENMARK 76,100POLAND[export] → GERMANY 75,300IRELAND[export] → SWEDEN 73,700ITALY[export] → BULGARIA 71,300ITALY[export] → POLAND 71,000IRELAND[export] → CZECH REPUBLIC 63,400ROMANIA[export] → GERMANY 58,800BELGIUM[export] → MALTA 55,700PORTUGAL[export] → ITALY 55,600GERMANY[export] → FRANCE 51,000SPAIN[export] → HUNGARY 50,100IRELAND[export] → DENMARK 44,600BELGIUM[export] → HUNGARY 43,000GERMANY[export] → NETHERLANDS 42,500FRANCE[export] → BULGARIA 42,000NETHERLANDS[export] → DENMARK 40,900ITALY[export] → DENMARK 40,700BELGIUM[export] → CZECH REPUBLIC 38,200NETHERLANDS[export] → GERMANY 38,200BULGARIA[export] → BELGIUM 35,400BELGIUM[export] → ESTONIA 34,300BULGARIA[export] → GREECE 34,300ITALY[export] → GERMANY 34,000ITALY[export] → FINLAND 32,700FRANCE[export] → CZECH REPUBLIC 32,500ESTONIA[export] → FINLAND 28,600DENMARK[export] → FINLAND 25,400GERMANY[export] → SWEDEN 24,800SPAIN[export] → FRANCE 24,500SPAIN[export] → GREECE 24,000FRANCE[export] → GERMANY 23,700BELGIUM[export] → ROMANIA 21,000ITALY[export] → FRANCE 20,700ROMANIA[export] → HUNGARY 16,700GERMANY[export] → ITALY 16,000ROMANIA[export] → GREECE 15,900HUNGARY[export] → AUSTRIA 13,600UNITED KINGDOM[export] → ITALY 12,800NETHERLANDS[export] → CZECH REPUBLIC 12,300BELGIUM[export] → IRELAND 11,500FRANCE[export] → LUXEMBOURG 11,400POLAND[export] → SWEDEN 9,600BELGIUM[export] → SLOVENIA 8,700HUNGARY[export] → UNITED KINGDOM 8,000SWEDEN[export] → ESTONIA 6,700ROMANIA[export] → AUSTRIA 6,400SLOVENIA[export] → ITALY 6,400CZECH REPUBLIC[export] → SLOVAKIA 6,300SPAIN[export] → CYPRUS 6,300NETHERLANDS[export] → LUXEMBOURG 5,700SPAIN[export] → BELGIUM 5,200SWEDEN[export] → POLAND 5,200FINLAND[export] → LATVIA 5,100FRANCE[export] → NETHERLANDS 5,100ITALY[export] → SLOVENIA 4,800SPAIN[export] → DENMARK 4,300BELGIUM[export] → UNITED KINGDOM 4,100NETHERLANDS[export] → SWEDEN 3,800BELGIUM[export] → POLAND 3,700FINLAND[export] → SWEDEN 3,700GERMANY[export] → AUSTRIA 3,700LITHUANIA[export] → ESTONIA 3,500SPAIN[export] → GERMANY 3,300HUNGARY[export] → POLAND 3,000SPAIN[export] → CZECH REPUBLIC 3,000LITHUANIA[export] → LATVIA 2,700LUXEMBOURG[export] → GERMANY 2,700SPAIN[export] → ESTONIA 2,500BELGIUM[export] → LITHUANIA 1,700ESTONIA[export] → SWEDEN 1,600SPAIN[export] → BULGARIA 1,600AUSTRIA[export] → SLOVENIA 1,200ITALY[export] → MALTA 1,200POLAND[export] → MALTA 1,200POLAND[export] → CZECH REPUBLIC 1,100SPAIN[export] → ROMANIA 1,100FRANCE[export] → SPAIN 1,000UNITED KINGDOM[export] → GERMANY 1,000ESTONIA[export] → LITHUANIA 900POLAND[export] → SLOVAKIA 900NETHERLANDS[export] → MALTA 700GREECE[export] → BELGIUM 600HUNGARY[export] → SLOVENIA 500LUXEMBOURG[export] → BELGIUM 400CZECH REPUBLIC[export] → POLAND 300LITHUANIA[export] → SWEDEN 300BELGIUM[export] → PORTUGAL 100FRANCE[export] → PORTUGAL 100GERMANY[export] → LUXEMBOURG 100GREECE[export] → CYPRUS 100ITALY[export] → GREECE 100ITALY[export] → ROMANIA 100SPAIN[export] → SLOVENIA 100AUSTRIA[export] 1,200AUSTRIA[export]SLOVENIA 15,300SLOVENIABELGIUM[export] 18,825,900BELGIUM[export]AUSTRIA 361,900AUSTRIABULGARIA 2,994,800BULGARIACYPRUS 291,800CYPRUSCZECH REPUBLIC 234,500CZECH REPUBLICDENMARK 206,600DENMARKESTONIA 157,900ESTONIAFINLAND 1,534,600FINLANDFRANCE 11,840,000FRANCEGERMANY 1,440,800GERMANYHUNGARY 1,348,700HUNGARYIRELAND 11,500IRELANDITALY 23,321,200ITALYLITHUANIA 2,600LITHUANIALUXEMBOURG 130,900LUXEMBOURGMALTA 58,800MALTANETHERLANDS 8,098,200NETHERLANDSPOLAND 1,064,100POLANDPORTUGAL 200PORTUGALROMANIA 248,500ROMANIASWEDEN 336,500SWEDENUNITED KINGDOM 274,200UNITED KINGDOMBULGARIA[export] 296,000BULGARIA[export]BELGIUM 6,368,400BELGIUMGREECE 74,300GREECECZECH REPUBLIC[export] 6,600CZECH REPUBLIC[export]SLOVAKIA 7,200SLOVAKIADENMARK[export] 242,000DENMARK[export]ESTONIA[export] 31,100ESTONIA[export]FINLAND[export] 8,800FINLAND[export]LATVIA 116,100LATVIAFRANCE[export] 4,836,900FRANCE[export]SPAIN 1,000SPAINGERMANY[export] 329,300GERMANY[export]GREECE[export] 700GREECE[export]HUNGARY[export] 1,071,500HUNGARY[export]IRELAND[export] 2,889,800IRELAND[export]ITALY[export] 2,205,900ITALY[export]LITHUANIA[export] 591,900LITHUANIA[export]LUXEMBOURG[export] 1,414,200LUXEMBOURG[export]NETHERLANDS[export] 5,310,800NETHERLANDS[export]POLAND[export] 10,659,100POLAND[export]PORTUGAL[export] 55,600PORTUGAL[export]ROMANIA[export] 5,493,100ROMANIA[export]SLOVENIA[export] 6,400SLOVENIA[export]SPAIN[export] 4,154,900SPAIN[export]SWEDEN[export] 11,900SWEDEN[export]UNITED KINGDOM[export] 2,097,000UNITED KINGDOM[export]

  1. #//schoolofdata.org/2013/02/20/made-to-measure-reshaping-horsemeat-importexport-data-to-fit-a-sankey-diagram/
  2. require(reshape)
  3. horseexportsEU <- read.delim(
  4. "https://dl.dropbox.com/u/1156404/horseexportsEU.txt"
  5. )
  6. #Get a "long" edge list from the 2d data table
  7. x=melt(horseexportsEU,id='COUNTRY')
  8. # When is what looks like a number to us not a number?
  9. #Turn the numbers into numbers by removing the comma, then casting to an integer
  10. x$value2=as.integer(as.character(gsub(",", "", x$value, fixed = TRUE) ))
  11. #More tidying...
  12. #1) If we have an NA (null/empty) value, make it -1
  13. x$value2[ is.na(x$value2) ] = -1
  14. #2) Column names with countries that originally contained spaces uses dots in place of spaces. Undo that.
  15. x$variable=gsub(".", " ", x$variable, fixed = TRUE)
  16. #I want to export a subset of the data
  17. xt=subset(x,value2>0,select=c('COUNTRY','variable','value2'))
  18. #name columns as what is expected by plugin
  19. colnames(xt) <- c("target","source","value")
  20. #need to make names in source and target different to prevent infinite loop
  21. xt$source <- paste0(xt$source,"[export]")
  22. sankeyPlot <- rCharts$new()
  23. sankeyPlot$setLib('.')
  24. sankeyPlot$setTemplate(script = "layouts/chart.html")
  25. sankeyPlot$set(
  26. data = xt,
  27. nodeWidth = 15,
  28. nodePadding = 10,
  29. layout = 32,
  30. width = 700,
  31. height = 400
  32. )
  33. sankeyPlot