MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / getSummaryStr

Method getSummaryStr

stats.go:254–284  ·  view source on GitHub ↗
(a []string)

Source from the content-addressed store, hash-verified

252}
253
254func (s *DiscreteStats) getSummaryStr(a []string) string {
255 s.summary(a)
256 summaryArray := s.getSummaryData()
257 result := ""
258 for _, i := range summaryArray {
259 var n, v string
260 n, v = i[0], i[1]
261 result = result + "#" + n + " : " + v + "\n"
262 }
263 result = result + "----------\n" + "Top 20 variable\n\n"
264 type kv struct {
265 Key string
266 Value int
267 }
268
269 //sortByStr map by value
270 var ss []kv
271 for k, v := range s.counter {
272 ss = append(ss, kv{k, v})
273 }
274
275 sort.Slice(ss, func(i, j int) bool {
276 return ss[i].Value > ss[j].Value
277 })
278
279 for _, kv := range ss {
280 result = result + "#" + kv.Key + " : " + I2S(kv.Value) + "\n"
281 }
282
283 return result
284}
285
286// getPlot generates a bar chart visualization for discrete data
287func (s *DiscreteStats) getPlot() string {

Callers

nothing calls this directly

Calls 3

summaryMethod · 0.95
getSummaryDataMethod · 0.95
I2SFunction · 0.85

Tested by

no test coverage detected