Method: Daru::Vector#object_summary
- Defined in:
- lib/daru/vector.rb
#object_summary ⇒ String
Displays summary for an object type Vector
976 977 978 979 980 981 982 983 984 985 986 987 |
# File 'lib/daru/vector.rb', line 976 def object_summary nval = count_values(*Daru::MISSING_VALUES) summary = "\n factors: #{factors.to_a.join(',')}" \ "\n mode: #{mode.to_a.join(',')}" \ "\n Distribution\n" data = frequencies.sort.each_with_index.map do |v, k| [k, v, '%0.2f%%' % ((nval.zero? ? 1 : v.quo(nval))*100)] end summary + Formatters::Table.format(data) end |