Sha256: 976845ce8a03793fbac0340d4ac16557e90f8ddcf5f565ab1d9a6a72426d9021

Contents?: true

Size: 1021 Bytes

Versions: 797

Compression:

Stored size: 1021 Bytes

Contents

#!/usr/bin/env ruby

require 'rbbt'
require 'rbbt/util/simpleopt'

require 'rbbt/util/R'

$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands

options = SOPT.setup <<EOF
Take logs

$ rbbt stat density <file>

Display summary information. Works with Tokyocabinet HDB and BDB as well.

-tch--tokyocabinet File is a TC HDB
-tcb--tokyocabinet_bd File is a TC BDB
-t--type* Type of tsv (single, list, double, flat)
-h--header_hash* Change the character used to mark the header line (defaults to #)
-f--field Field to change
-h--help Help
EOF

SOPT.usage if options[:help]

file = ARGV.shift

if file == '-' or file.nil?
  file = STDIN 
else
  file = Open.open file
end

parser = TSV::Parser.new file, options

options[:fields] = [options.delete(:field) || 0]
puts TSV.header_lines(parser.key_field, parser.fields)
parser.traverse(options.merge(:type => :list)) do |k,v|
  v = v.first
  v = Array === v ? v.collect{|e| Math.log(e.to_f) } : [Math.log(v.to_f)]
  puts [k,v].flatten * "\t"
end

Version data entries

797 entries across 797 versions & 1 rubygems

Version Path
rbbt-util-6.0.3 share/rbbt_commands/stat/log
rbbt-util-5.44.1 share/rbbt_commands/stat/log
rbbt-util-5.43.0 share/rbbt_commands/stat/log
rbbt-util-5.42.0 share/rbbt_commands/stat/log
rbbt-util-5.41.1 share/rbbt_commands/stat/log
rbbt-util-5.41.0 share/rbbt_commands/stat/log
rbbt-util-5.40.5 share/rbbt_commands/stat/log
rbbt-util-5.40.4 share/rbbt_commands/stat/log
rbbt-util-5.40.3 share/rbbt_commands/stat/log
rbbt-util-5.40.0 share/rbbt_commands/stat/log
rbbt-util-5.39.0 share/rbbt_commands/stat/log
rbbt-util-5.38.1 share/rbbt_commands/stat/log
rbbt-util-5.38.0 share/rbbt_commands/stat/log
rbbt-util-5.37.16 share/rbbt_commands/stat/log
rbbt-util-5.37.15 share/rbbt_commands/stat/log
rbbt-util-5.37.14 share/rbbt_commands/stat/log
rbbt-util-5.37.13 share/rbbt_commands/stat/log
rbbt-util-5.37.12 share/rbbt_commands/stat/log
rbbt-util-5.37.11 share/rbbt_commands/stat/log
rbbt-util-5.37.10 share/rbbt_commands/stat/log