lib/rbbt/util/R.rb in rbbt-util-5.15.1 vs lib/rbbt/util/R.rb in rbbt-util-5.15.2

- old
+ new

@@ -2,12 +2,13 @@ require 'rbbt/tsv' require 'rbbt/util/R/eval' module R - LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'../../../share/Rlib') + 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, options = {}) cmd =<<-EOF # Loading basic rbbt environment source('#{UTIL}'); @@ -125,13 +126,14 @@ def R(script, source = nil, open_options = {}) open_options, source = source, nil if Hash === source source ||= Misc.process_options open_options, :source - source = [source] if String === source + source = [source] unless Array === source require_sources = source.collect{|source| - "source('#{source}');" + source = R::LIB_DIR["plot.R"] if source == :plot + "source('#{source}')" } * ";\n" if Array === source and source.any? script = require_sources + "\n\n" + script if require_sources r_options = Misc.pull_keys open_options, :R