Sha256: 875adf7316997cf069d49537bf794f1654b3653986e2bef4ff51369287b9256a

Contents?: true

Size: 877 Bytes

Versions: 296

Compression:

Stored size: 877 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
require 'rbbt/util/R'

class TestR < Test::Unit::TestCase
  def test_sum
    assert_equal "6", R.run('cat(3+3)').read.split(/\n/).last
  end

  def test_tsv_R
    tsv = TSV.setup({:a => 1, :b => 2})
    tsv2 = tsv.R <<-EOF
data = data + 1
    EOF
    assert_equal "2", tsv2["a"].first
  end

  def test_format_tsv
    tsv = TSV.setup({"a" => [1], "b" => [2]}, :type => :list, :key_field => "Letter", :fields => ["Number"])
    assert tsv.transpose("Field").include? "Number"
  end

  def test_error
    assert_raise ProcessFailed do
      R.run <<-EOF
        fadsfasdf
      EOF
    end
  end

  def test_hash2Rargs
    hash = {:verbose => false, :iter => 1000, :method => 'kmeans'}
    str = R.hash2Rargs(hash)
    assert_equal "verbose=FALSE, iter=1000, method='kmeans'", str
  end
end

Version data entries

296 entries across 296 versions & 1 rubygems

Version Path
rbbt-util-5.26.153 test/rbbt/util/test_R.rb
rbbt-util-5.26.152 test/rbbt/util/test_R.rb
rbbt-util-5.26.151 test/rbbt/util/test_R.rb
rbbt-util-5.26.150 test/rbbt/util/test_R.rb
rbbt-util-5.26.149 test/rbbt/util/test_R.rb
rbbt-util-5.26.148 test/rbbt/util/test_R.rb
rbbt-util-5.26.147 test/rbbt/util/test_R.rb
rbbt-util-5.26.146 test/rbbt/util/test_R.rb
rbbt-util-5.26.145 test/rbbt/util/test_R.rb
rbbt-util-5.26.144 test/rbbt/util/test_R.rb
rbbt-util-5.26.143 test/rbbt/util/test_R.rb
rbbt-util-5.26.142 test/rbbt/util/test_R.rb
rbbt-util-5.26.141 test/rbbt/util/test_R.rb
rbbt-util-5.26.140 test/rbbt/util/test_R.rb
rbbt-util-5.26.139 test/rbbt/util/test_R.rb
rbbt-util-5.26.138 test/rbbt/util/test_R.rb
rbbt-util-5.26.137 test/rbbt/util/test_R.rb
rbbt-util-5.26.136 test/rbbt/util/test_R.rb
rbbt-util-5.26.135 test/rbbt/util/test_R.rb
rbbt-util-5.26.134 test/rbbt/util/test_R.rb