Sha256: e25f22c35c9ec9b3d2bae7ed26c4703f2e7f642bb49532cb70d243ef7381d027

Contents?: true

Size: 529 Bytes

Versions: 1

Compression:

Stored size: 529 Bytes

Contents

require 'rbbt/util/cmd'

module R

  LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'../../../share/lib/R')
  UTIL    = File.join(LIB_DIR, 'util.R')

  def self.run(command, options = {})
    cmd = "source('#{UTIL}');\n"
    case
    when IO === command
      cmd << command.read
    when File.exists?(command)
      cmd << File.open(command, 'r') do |f| f.read end
    else
      cmd << command
    end

    Log.debug "R Script:\n#{ cmd }"

    CMD.cmd('R --vanilla --slave', options.merge(:in => cmd))
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbbt-util-1.2.1 lib/rbbt/util/R.rb