Class: Daru::IO::Exporters::RDS
- Defined in:
- lib/daru/io/exporters/rds.rb
Overview
RDS Exporter Class, that extends to_rds_string
and write_rds
methods to
Daru::DataFrame
instance variables
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(dataframe, r_variable) ⇒ RDS
constructor
Initializes a RDS Exporter instance.
-
#to_s ⇒ String
Exports a RDS Exporter instance to a file-writable String.
-
#write(path) ⇒ Object
Exports a RDS Exporter instance to a rds file.
Methods inherited from Base
Constructor Details
#initialize(dataframe, r_variable) ⇒ RDS
Initializes a RDS Exporter instance.
26 27 28 29 30 31 |
# File 'lib/daru/io/exporters/rds.rb', line 26 def initialize(dataframe, r_variable) optional_gem 'rsruby' super(dataframe) @r_variable = r_variable end |
Instance Method Details
#to_s ⇒ String
Exports a RDS Exporter instance to a file-writable String.
41 42 43 |
# File 'lib/daru/io/exporters/rds.rb', line 41 def to_s super end |
#write(path) ⇒ Object
Exports a RDS Exporter instance to a rds file.
51 52 53 54 55 56 |
# File 'lib/daru/io/exporters/rds.rb', line 51 def write(path) @instance = RSRuby.instance @statements = process_statements(@r_variable, @dataframe) @statements << "saveRDS(#{@r_variable}, file='#{path}')" @statements.each { |statement| @instance.eval_R(statement) } end |