Module: DF::ARFF
- Included in:
- DataFrame
- Defined in:
- lib/data_frame/arff.rb
Overview
Turns a data frame into ARFF-formatted content.
Instance Method Summary collapse
- #to_arff ⇒ Object
-
#to_csv(include_header = true) ⇒ Object
(also: #arff_items)
Used in arff, but generally useful.
Instance Method Details
#to_arff ⇒ Object
13 14 15 |
# File 'lib/data_frame/arff.rb', line 13 def to_arff arff_header + to_csv(false) end |
#to_csv(include_header = true) ⇒ Object Also known as: arff_items
Used in arff, but generally useful.
6 7 8 9 10 11 |
# File 'lib/data_frame/arff.rb', line 6 def to_csv(include_header=true) value = include_header ? self.labels.map{|e| e.to_s}.join(',') + "\n" : '' self.items.inject(value) do |list, e| list << e.map {|cell| cell.to_s}.join(',') + "\n" end end |