Class: R::DataFrame
Constant Summary
Constants inherited
from Object
Object::EXPLICIT_RUBY_SURFACE
Instance Attribute Summary
Attributes inherited from Object
#expression, #r_interop
Instance Method Summary
collapse
#[]
#[], #size
Methods inherited from Object
#==, build, build_class_probe_count, build_from_r_class_string, build_from_wrapper_tag, #call, class_probe_fetch_r_class, increment_build_class_probe_count!, #initialize, #inspect, #instance_of?, #instance_variable_get, #instance_variable_set, #is_a?, #method_missing, #nil?, #pretty_print, #rclass, reset_build_counters!, #respond_to?, #send, #to_ary, #to_i, #to_ruby, #to_s, #typeof
Methods included from ExecUniOp
#exec_uni_oper
#!, #+@, #-@
Methods included from ExecBinOp
#coerce, #exec_bin_oper
#!=, #%, #*, #**, #+, #-, #/, #<, #<=, #>, #>=, #_, #eq, #int_div, #til
Constructor Details
This class inherits a constructor from R::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class R::Object
Instance Method Details
#[]=(index, *args) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/R_interface/rdata_frame.rb', line 37
def []=(index, *args)
values = args[-1]
res = if index.is_a? ::Array
::R::Support.exec_function("`[[<-`", self, i: index, value: values)
else
idx2 = (args.size > 1) ? args[-2] : nil
if idx2
::R::Support.exec_function("`[<-`", self, i: index, j: idx2, value: values)
else
::R::Support.exec_function("`[<-`", self, i: index, value: values)
end
end
@r_interop = res.r_interop
self
end
|
21
22
23
|
# File 'lib/R_interface/rdata_frame.rb', line 21
def class
::R::DataFrame
end
|
#each_column ⇒ Object
60
61
62
63
64
|
# File 'lib/R_interface/rdata_frame.rb', line 60
def each_column
(1..ncol >> 0).each do |i|
yield self[:all, i], self.names[i] >> 0
end
end
|
54
55
56
57
58
|
# File 'lib/R_interface/rdata_frame.rb', line 54
def each_row
(1..nrow >> 0).each do |i|
yield self[i, :all], self.rownames[i] >> 0
end
end
|
#method_missing_assign(column_name, arg) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/R_interface/rdata_frame.rb', line 30
def method_missing_assign(column_name, arg)
res = ::R::Support.exec_function("`[[<-`", self, i: column_name, value: arg)
@r_interop = res.r_interop
res
end
|
#qplot(*args) ⇒ Object
25
26
27
28
|
# File 'lib/R_interface/rdata_frame.rb', line 25
def qplot(*args)
::R.print(::R.qplot(*args, data: self))
end
|
#unboxed_get(index = nil, depth = 0) ⇒ Object
Phase 5.2: unbox entire data.frame via NewBridgeAdapter#pull_dataframe.
This avoids the generic list-unboxing path which relies on scalar-only eval.
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/R_interface/rdata_frame.rb', line 9
def unboxed_get(index = nil, depth = 0)
return ::R.bridge.pull_dataframe(@r_interop) if index.nil?
if index.is_a?(::Integer)
val = ::R::Support.eval("#{@r_interop}[[#{index + 1}]]")
return val unless val.is_a?(::R::Object)
return val.unboxed_get(nil, depth + 1)
end
super
end
|