lib/rbbt/util/R.rb in rbbt-util-5.17.12 vs lib/rbbt/util/R.rb in rbbt-util-5.17.13

- old
+ new

@@ -6,11 +6,15 @@ LIB_DIR = Path.setup(File.join(File.expand_path(File.dirname(__FILE__)),'../../../share/Rlib')) UTIL = File.join(LIB_DIR, 'util.R') PLOT = File.join(LIB_DIR, 'plot.R') - def self.run(command, source = nil, options = {}) + def self.run(command, source = nil, options = nil) + source, options = nil, source if options.nil? and Hash === source + options = {} if options.nil? + monitor = options.delete :monitor + cmd =<<-EOF # Loading basic rbbt environment source('#{UTIL}'); EOF @@ -31,10 +35,10 @@ cmd << command end Log.debug{"R Script:\n#{ cmd }"} - if options.delete :monitor + if monitor io = CMD.cmd('R --vanilla --quiet', options.merge(:in => cmd, :pipe => true, :log => true)) while line = io.gets puts line end nil