def calculate_averages(results)
      Array.new(results.first.size) do |require_number|
        samples = results.map { |r| r[require_number] }
        first_sample = samples.first

        average = initialize_average_with_copied_fields(first_sample)
        AVERAGED_FIELDS.map do |field|
          next unless first_sample.key?(field)

          average[field] = calculate_average(samples.map { |s| s[field] })
        end
        average
      end
    end
def calculate_averages(results)
      Array.new(results.first.size) do |require_number|
        samples = results.map { |r| r[require_number] }
        first_sample = samples.first

        average = initialize_average_with_copied_fields(first_sample)
        AVERAGED_FIELDS.map do |field|
          next unless first_sample.key?(field)

          average[field] = calculate_average(samples.map { |s| s[field] })
        end
        average
      end
    end
Take corresponding results array values and compare them