lib/rbbt/util/R.rb in rbbt-util-5.21.121 vs lib/rbbt/util/R.rb in rbbt-util-5.21.122
- old
+ new
@@ -122,11 +122,10 @@
end
end
end
-
def self.ruby2R(object)
case object
when Float::INFINITY
"Inf"
when nil
@@ -150,9 +149,15 @@
when Hash
"list(" << object.collect{|k,v| [k, ruby2R(v)] * "="} * ", " << ")"
else
raise "Type of object not known: #{ object.inspect }"
end
+ end
+
+ def self.hash2Rargs(hash)
+ hash.collect do |k,v|
+ [k.to_s, ruby2R(v)] * "="
+ end * ", "
end
def self.tsv(file, options = {})
options = Misc.add_defaults :header_hash => '', :sep => / +/, :type => :list, :key_field => 'ID'
key_field = Misc.process_options options, :key_field