module R::Scope
Public Class Methods
with(symbol, *args)
click to toggle source
# File lib/R_interface/rsupport_scope.rb, line 27 def self.with(symbol, *args) attrs = [] dataframe = args[0] args.each_with_index do |arg, index| arg.names.each { |n| attrs << n.to_sym } end Class.new do # create accessor functions for every variable name attrs.each do |name| define_method (name) do dataframe.method_missing(name) end end #---------------------------------------------------------------------------------------- # #---------------------------------------------------------------------------------------- define_method (:subset) do |*missing_args| R::Support.exec_function(R.subset_method, dataframe, *missing_args) end #---------------------------------------------------------------------------------------- # #---------------------------------------------------------------------------------------- define_method (:method_missing) do |missing_symbol, *missing_args| R::Support.process_missing(missing_symbol, false, dataframe, *missing_args) end end end