class Array

Public Instance Methods

distance(other) click to toggle source
# File lib/rust-probabilities.rb, line 12
def distance(other)
    raise TypeError, "no implicit conversion of #{other.class} into Array" unless other.is_a? Array
    
    longest, shortest = self.size > other.size ? [self, other] : [other, self]
    
    distance = 0
    for i in 0...longest.size
        distance += longest[i].to_i.distance(shortest[i].to_i)
    end
    
    return distance
end
distribution() click to toggle source
# File lib/rust-core.rb, line 800
def distribution
    result = {}
    self.each do |value|
        result[value] = result[value].to_i + 1
    end
    return result
end
to_R() click to toggle source
# File lib/rust-core.rb, line 796
def to_R
    return "c(#{self.map { |e| e.to_R }.join(",")})"
end