Sha256: 5445d2ca8e286f4bc1d35c922fa1a4da16ed54d60450b534c17df3fc36de29f4
Contents?: true
Size: 867 Bytes
Versions: 73
Compression:
Stored size: 867 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 Calculate density $ 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 -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 values = file.read.split("\n").collect{|v| v.to_f} res = TmpFile.with_file do |tmp| R.run <<-EOF values = #{R.ruby2R values} d = density(values) df = data.frame(x=d$x, y=d$y) rbbt.tsv.write(file='#{ tmp }', df) EOF Open.read(tmp) end puts res.split("\n")[1..-1].collect{|l| l.split("\t")[1,2] * "\t"} * "\n"
Version data entries
73 entries across 73 versions & 1 rubygems