lib/rbbt/util/R.rb in rbbt-util-5.1.0 vs lib/rbbt/util/R.rb in rbbt-util-5.2.0
- old
+ new
@@ -36,10 +36,21 @@
end
CMD.cmd("env R_PROFILE='#{init_file}' xterm R")
end
end
+ def self.ruby2R(object)
+ case object
+ when String
+ "'#{ object }'"
+ when Fixnum
+ object
+ when Array
+ "c(#{object.collect{|e| ruby2R(e) } * ", "})"
+ end
+ end
+
end
module TSV
def R(script, open_options = {})
@@ -62,6 +73,5 @@
Open.write(f, self.to_s)
R.interactive("data_file = '#{f}';\n")
end
end
end
-