Method: BioDSL::CSV.read_array

Defined in:
lib/BioDSL/csv.rb

.read_array(file, options = {}) ⇒ Object

Method that reads all CSV data from a file into an array of arrays (array of rows) which is returned. In the default mode all columns are read. Using the select option subselects the columns based on a given Array or if a heder line is present a given Hash. Visa versa for the reject option. Header lines are prefixed with ‘#’ and are returned if the include_header option is given.

Options:

* include_header
* delimiter.
* select.
* reject.


78
79
80
81
82
83
84
85
86
# File 'lib/BioDSL/csv.rb', line 78

def self.read_array(file, options = {})
  data = []

  open(file) do |ios|
    ios.each_array(options) { |row| data << row }
  end

  data
end