require 'daru' dv = Daru::Vector.new [:a, 1, :a, 1, :c], type: :category dv.frequencies dv = Daru::Vector.new [:a, 1, :a, 1, :c], type: :category, categories: [:a, :b, :c, 1] dv.frequencies dv = Daru::Vector.new [:a, 1, :a, 1, :c], categories: [:a, :b, :c, 1], ordered: false, type: :category dv.min dv = Daru::Vector.new [:a, 1, :a, 1, :c], ordered: true, categories: [:a, :b, :c, 1], type: :category dv.min dv.sort! dv = Daru::Vector.new [:a, 1, :c, 1, :c], type: :category dv.categories = [:a, :b, :c, 1] dv.categories dv = Daru::Vector.new [:a, 1, :c, 1, :c], type: :category dv.ordered? dv.ordered = true dv.ordered? dv = Daru::Vector.new [:a, :a, :a, :b, :b, :c], type: :category dv.summary dv = Daru::Vector.new ['third']*3 + ['second']*2 + ['first'], type: :category, categories: ['first', 'second', 'third'] dv.frequencies dv dv.min dv.ordered = true dv.min dv.max dv.sort! dv dv[0] = 'fourth' dv.add_category 'fourth' dv[0] = 'fourth' dv dv.categories dv = Daru::Vector.new [1, 2, 'third', 2, 1], type: :category dv.rename_categories 1 => 'first', 2 => 'second' dv dv = Daru::Vector.new [1, 1, 2, 2, 3, 1], index: :a..:f, type: :category dv[0..2] dv.at -1 dv.set_at [0, 1], 3 dv dv = Daru::Vector.new ['I', 'II', 'I', 'III', 'IV', 'I', 'II'], type: :category, categories: ['I', 'II', 'III', 'IV'] dv.ordered = true dv.frequencies dv.where(dv.eq('I')) dv.where(dv.gt('II')) df = Daru::DataFrame.new({ a: (1..7).to_a, b: ('a'..'g').to_a, c: ['I', 'II', 'I', 'III', 'IV', 'I', 'II'] }) df.c = df.c.to_category df df.where(df.c.gt('I') & df.c.lt('IV')) dv = Daru::Vector.new ['I', 'II', 'I', 'III', 'IV', 'I', 'II'], type: :category, categories: ['I', 'II', 'III', 'IV'] dv.name = 'Rank' dv.contrast_code dv.base_category = 'IV' dv.contrast_code dv.coding_scheme = :deviation dv.contrast_code