Template:CountryTable
From Metabolomics.JP
(Difference between revisions)
| Line 1: | Line 1: | ||
| + | <table> | ||
| + | <th colspan=2>Top 5 institutes in this country</th> | ||
| + | <tr><td> | ||
| + | {{#lua: | ||
| + | local count = {}; | ||
| + | for word in stdin:gmatch("[%d%a/_:]+") do | ||
| + | au, inst = string.match(word,"&&([%a._]+)&&([%a%d,._]+)&&"); | ||
| + | if (count[inst] == null) then | ||
| + | count[inst] = 1; | ||
| + | else | ||
| + | count[inst] = count[inst] + 1; | ||
| + | end | ||
| + | end | ||
| + | local hash = {}; | ||
| + | local list = {}; | ||
| + | for inst, c in pairs(count) do | ||
| + | table.insert(list, c); | ||
| + | if (hash[c] == null) then | ||
| + | hash[c] = inst; | ||
| + | else | ||
| + | hash[c] = hash[c] .. ";" .. inst; | ||
| + | end | ||
| + | end | ||
| + | table.sort(list); | ||
| + | local i=0; | ||
| + | local output = ""; | ||
| + | local num; | ||
| + | while(i < 5) do | ||
| + | num = table.remove(list); | ||
| + | if (num == null) then break; end | ||
| + | inst = hash[num]; | ||
| + | i = i + 1; | ||
| + | output = output .. inst .. " (" .. num .." authors);"; | ||
| + | end | ||
| + | print(output); | ||
| + | |{{{1|}}} | ||
| + | }} | ||
| + | </td> | ||
| + | |||
| + | </tr> | ||
| + | </table> | ||
| + | |||
{| class="sortable" border="1" cellpadding="2" cellspacing="1" style="font-size: smaller; float: center; clear: none; margin: 1em 1em 1em 1em" | {| class="sortable" border="1" cellpadding="2" cellspacing="1" style="font-size: smaller; float: center; clear: none; margin: 1em 1em 1em 1em" | ||
|- | |- | ||
Revision as of 20:03, 14 September 2008
| Top 5 institutes in this country |
|---|
|
|
| Author | Affiliation | Country |
|---|