Class: Rust::ANOVAModel
Class Method Summary
collapse
Instance Method Summary
collapse
pull_priority, #r_hash, #r_mirror, #r_mirror_to
Constructor Details
#initialize(model) ⇒ ANOVAModel
Returns a new instance of ANOVAModel.
35
36
37
|
# File 'lib/rust/models/anova.rb', line 35
def initialize(model)
@model = model
end
|
Class Method Details
.can_pull?(type, klass) ⇒ Boolean
5
6
7
|
# File 'lib/rust/models/anova.rb', line 5
def self.can_pull?(type, klass)
return type == "list" && [klass].flatten.include?("aov")
end
|
.generate(formula, data, **options) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/rust/models/anova.rb', line 19
def self.generate(formula, data, **options)
mapped = ""
if options.size > 0
mapped = options.map { |k, v| "#{k}=#{v}" }.join(", ")
mapped = ", " + mapped
end
Rust.exclusive do
Rust["aov.data"] = data
Rust._eval("aov.model.result <- aov(#{formula.to_R}, data=aov.data#{mapped})")
result = ANOVAModel.new(Rust["aov.model.result"])
result.r_mirror_to("aov.model.result")
return result
end
end
|
.pull_variable(variable, type, klass) ⇒ Object
9
10
11
12
13
|
# File 'lib/rust/models/anova.rb', line 9
def self.pull_variable(variable, type, klass)
model = RustDatatype.pull_variable(variable, Rust::List)
return ANOVAModel.new(model)
end
|
Instance Method Details
#load_in_r_as(variable_name) ⇒ Object
15
16
17
|
# File 'lib/rust/models/anova.rb', line 15
def load_in_r_as(variable_name)
@model.load_in_r_as(variable_name)
end
|
39
40
41
|
# File 'lib/rust/models/anova.rb', line 39
def model
@model
end
|
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/rust/models/anova.rb', line 43
def summary
unless @summary
Rust.exclusive do
Rust._eval("aov.smr <- summary(#{self.r_mirror})")
@summary = Rust['aov.smr']
end
end
return @summary
end
|