28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/R_interface/rsupport_scope.rb', line 28
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
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
|