Sha256: 79528dbb8d17183b07f3e53172af43b96083f6d5db78475633a7bb5bb8f265aa

Contents?: true

Size: 873 Bytes

Versions: 12

Compression:

Stored size: 873 Bytes

Contents

#!/usr/bin/env ruby

require 'pione'

# infos
name    = Pione.val "$*"
score_f = Pione.val "$I[1]"

# calc stat
scores = File.readlines(score_f).map{|line| line.split(" ")[1].to_i}
mean   = scores.reduce(:+).to_f / scores.size
sd     = Math.sqrt(scores.map{|i| (mean-i) ** 2}.reduce(:+) / scores.size)

# build report
report = <<TXT
# Statistics of #{name}

## Scores

![Score of #{name}](#{name}_bar-graph.png)

## Statistics

| stat  | value                    |
|-------|--------------------------|
| Sum   | #{scores.reduce(:+)}     |
| Count | #{scores.size}           |
| Max   | #{scores.max}            |
| Min   | #{scores.min}            |
| Med   | #{scores[scores.size/2]} |
| Mean  | #{mean}                  |
| SD    | #{sd}                    |
TXT

# output
Pione::Location[Pione.val("$O[1]")].write(report)
Pione::Location[Pione.val("$O[2]")].write(mean)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pione-0.5.0 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.5.0.alpha.2 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.5.0.alpha.1 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.4.2 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.4.1 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.4.0 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.3.2 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.3.1 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.3.0 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.2.2 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.2.1 example/ScoreAggregation/bin/personal-pre-statistics.rb
pione-0.2.0 example/ScoreAggregation/bin/personal-pre-statistics.rb