Sha256: 5429e2d7e01065dd02ceb024e9c902e9563255c603563d5216db7f12e7a5ef64

Contents?: true

Size: 508 Bytes

Versions: 10

Compression:

Stored size: 508 Bytes

Contents

# Support for converting data to R data structures to support rserve-client

module Daru
  class DataFrame
    def to_REXP # rubocop:disable Style/MethodName
      names = @vectors.to_a
      data  = names.map do |f|
        Rserve::REXP::Wrapper.wrap(self[f].to_a)
      end
      l = Rserve::Rlist.new(data, names.map(&:to_s))

      Rserve::REXP.create_data_frame(l)
    end
  end

  class Vector
    def to_REXP # rubocop:disable Style/MethodName
      Rserve::REXP::Wrapper.wrap(to_a)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
daru-0.3 lib/daru/extensions/rserve.rb
daru-0.2.2 lib/daru/extensions/rserve.rb
daru-0.2.1 lib/daru/extensions/rserve.rb
daru-0.2.0 lib/daru/extensions/rserve.rb
daru-0.1.6 lib/daru/extensions/rserve.rb
daru-0.1.5 lib/daru/extensions/rserve.rb
daru-0.1.4.1 lib/daru/extensions/rserve.rb
daru-0.1.4 lib/daru/extensions/rserve.rb
daru-0.1.3.1 lib/daru/extensions/rserve.rb
daru-0.1.3 lib/daru/extensions/rserve.rb