Module: Statsample::Mondrian

Defined in:
lib/statsample/converters.rb

Class Method Summary collapse

Class Method Details

.write(dataset, filename) ⇒ Object


39
40
41
42
43
44
45
46
47
# File 'lib/statsample/converters.rb', line 39

def write(dataset,filename)
  File.open(filename,"wb") do |fp|
    fp.puts dataset.vectors.to_a.join("\t")
    dataset.each_row do |row|
      row2 = row.map { |v| v.nil? ? "NA" : v.to_s.gsub(/\s+/,"_") }
      fp.puts row2.join("\t")
    end
  end
end