Class: Rover::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/rover/group.rb

Instance Method Summary collapse

Constructor Details

#initialize(df, columns) ⇒ Group

Returns a new instance of Group.



3
4
5
6
7
# File 'lib/rover/group.rb', line 3

def initialize(df, columns)
  @df = df
  @columns = columns
  check_columns
end

Instance Method Details

#group(*columns) ⇒ Object



9
10
11
# File 'lib/rover/group.rb', line 9

def group(*columns)
  Group.new(@df, @columns + columns.flatten)
end

#plot(*args, **options) ⇒ Object

Raises:

  • (ArgumentError)


26
27
28
29
30
31
32
# File 'lib/rover/group.rb', line 26

def plot(*args, **options)
  raise ArgumentError, "Multiple groups not supported" if @columns.size > 1
  # same message as Ruby
  raise ArgumentError, "unknown keyword: :group" if options.key?(:group)

  @df.plot(*args, **options, group: @columns.first)
end