galaaz 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -5
- data/README.md +200 -128
- data/Rakefile +17 -10
- data/bin/galaaz +10 -2
- data/bin/galaaz-jruby +3 -6
- data/bin/galaaz-ruby +16 -0
- data/bin/galaaz_jruby_env.inc.sh +19 -3
- data/bin/galaaz_ruby_env.inc.sh +38 -0
- data/bin/gbookdown +2 -3
- data/bin/gknit +2 -3
- data/bin/gstudio +4 -4
- data/bin/run_all_rspec +6 -5
- data/bin/run_example +10 -7
- data/bin/run_old_rspec +6 -5
- data/bin/run_rspec +9 -8
- data/bin/run_slow_rspec +6 -5
- data/blogs/R-on-Rails-Planning-Document.md +79 -112
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-gfm/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-gfm/scatter_plot_rb.png +0 -0
- data/blogs/gknit/gknit_files/figure-gfm/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-gfm/diverging_bar.png +0 -0
- data/blogs/manual/manual.Rmd +22 -19
- data/blogs/manual/manual.md +200 -128
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/violin_with_jitter.png +0 -0
- data/blogs/test/test.md +10 -0
- data/examples/50Plots_MasterList/ScatterPlot.rb +2 -1
- data/examples/50Plots_MasterList/scatter_plot.rb +1 -0
- data/examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb +1 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb +1 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz_optimized.rb +1 -0
- data/examples/islr/all.rb +1 -0
- data/examples/islr/ch2.spec.rb +1 -0
- data/examples/islr/ch3.spec.rb +1 -0
- data/examples/islr/ch3_boston.rb +1 -0
- data/examples/islr/ch3_multiple_regression.rb +1 -0
- data/examples/islr/ch6.spec.rb +1 -0
- data/examples/islr/x_y_rnorm.jpg +0 -0
- data/examples/misc/ggplot.rb +2 -1
- data/examples/misc/moneyball.rb +1 -0
- data/examples/misc/subsetting.rb +1 -0
- data/examples/multithread_shards_to_r/shards_to_r.rb +1 -0
- data/examples/sthda_ggplot/all.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/density_gg.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_area.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_density.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_dotplot.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_freqpoly.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_histogram.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/histogram_density.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/stat.rb +1 -0
- data/examples/sthda_ggplot/one_variable_discrete/bar.rb +1 -0
- data/examples/sthda_ggplot/qplots/box_violin_dot.rb +1 -0
- data/examples/sthda_ggplot/qplots/scatter_plots.rb +1 -0
- data/examples/sthda_ggplot/scatter_gg.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_bin2d.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_density2d.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_hex.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_point.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_smooth.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/misc.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_function/geom_area.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_bar.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_boxplot.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_dotplot.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_jitter.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_line.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_violin.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_disc/geom_jitter.rb +1 -0
- data/examples/sthda_ggplot/two_variables_error/geom_crossbar.rb +1 -0
- data/lib/R_interface/r_arrow.rb +37 -0
- data/lib/R_interface/rvector.rb +15 -0
- data/lib/galaaz/arrow_ipc/java_arrow_backend.rb +250 -0
- data/lib/galaaz/arrow_ipc/red_arrow_backend.rb +126 -0
- data/lib/galaaz/arrow_ipc.rb +167 -0
- data/lib/galaaz/cli.rb +531 -0
- data/lib/galaaz.rb +6 -0
- data/lib/galaaz_jruby.rb +17 -2
- data/lib/galaaz_ruby.rb +34 -0
- data/lib/new_bridge/envelope.rb +2 -2
- data/new_bridge_specs/arrow_ipc_async_spec.rb +90 -0
- data/new_bridge_specs/arrow_ipc_export_async_spec.rb +68 -0
- data/r_requires/arrow.txt +3 -0
- data/r_requires/knit-extras.txt +4 -0
- data/r_requires/knit.txt +4 -0
- data/specs/arrow_ipc_export_spec.rb +62 -0
- data/specs/arrow_ipc_handoff_spec.rb +97 -0
- data/specs/gknit_include_engine_spec.rb +2 -2
- data/specs/gknit_install_timeout_report_spec.rb +2 -2
- data/specs/gknit_internal_error_report_spec.rb +2 -2
- data/specs/gknit_vector_map_output_spec.rb +2 -2
- data/version.rb +1 -1
- metadata +50 -13
data/examples/islr/all.rb
CHANGED
data/examples/islr/ch2.spec.rb
CHANGED
data/examples/islr/ch3.spec.rb
CHANGED
data/examples/islr/ch3_boston.rb
CHANGED
data/examples/islr/ch6.spec.rb
CHANGED
data/examples/islr/x_y_rnorm.jpg
CHANGED
|
Binary file
|
data/examples/misc/ggplot.rb
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
##########################################################################################
|
|
23
23
|
|
|
24
24
|
require 'galaaz'
|
|
25
|
+
using Galaaz::SymbolDSL
|
|
25
26
|
require 'ggplot'
|
|
26
27
|
|
|
27
28
|
module LightBlueTheme
|
|
@@ -154,7 +155,7 @@ R.grid__newpage
|
|
|
154
155
|
R.geom_point('')).print
|
|
155
156
|
=end
|
|
156
157
|
|
|
157
|
-
a = gets.chomp
|
|
158
|
+
a = gets.chomp if $stdin.tty?
|
|
158
159
|
|
|
159
160
|
|
|
160
161
|
=begin
|
data/examples/misc/moneyball.rb
CHANGED
data/examples/misc/subsetting.rb
CHANGED
data/lib/R_interface/r_arrow.rb
CHANGED
|
@@ -63,6 +63,43 @@ module R
|
|
|
63
63
|
R.arrow___as_arrow_table(r_df)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
# Open an Arrow IPC file (written by Galaaz::ArrowIpc or compatible) as an
|
|
67
|
+
# R-side Arrow Table. Materializes the table in R so the Ruby process may
|
|
68
|
+
# unlink the path immediately after this call returns (Stage B1 lifetime).
|
|
69
|
+
#
|
|
70
|
+
# This is IPC/mmap file handoff — not zero-copy shared heap with Ruby.
|
|
71
|
+
#
|
|
72
|
+
# @param path [String] filesystem path visible to the R process
|
|
73
|
+
# @return [R::Object] Arrow Table proxy
|
|
74
|
+
def self.open_ipc(path)
|
|
75
|
+
path = File.expand_path(path.to_s)
|
|
76
|
+
ok = R::Support.eval("requireNamespace('arrow', quietly=TRUE)")
|
|
77
|
+
unless ok == true
|
|
78
|
+
raise LoadError, "R package 'arrow' is required for R::Arrow.open_ipc"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
R.arrow___read_ipc_file(path, as_data_frame: false)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Write an R Arrow Table / data.frame to an Arrow IPC file Ruby can read
|
|
85
|
+
# with Galaaz::ArrowIpc.read (Stage B2). Only the path should cross NewBridge.
|
|
86
|
+
#
|
|
87
|
+
# @param r_obj [R::Object] Table, RecordBatch, or data.frame/tibble in R
|
|
88
|
+
# @param path [String, nil] destination; default a new scratch path
|
|
89
|
+
# @return [String] absolute path (fsync'd from Ruby after R returns)
|
|
90
|
+
def self.write_ipc(r_obj, path = nil)
|
|
91
|
+
ok = R::Support.eval("requireNamespace('arrow', quietly=TRUE)")
|
|
92
|
+
unless ok == true
|
|
93
|
+
raise LoadError, "R package 'arrow' is required for R::Arrow.write_ipc"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
path = path.nil? || path.to_s.empty? ? Galaaz::ArrowIpc.allocate_path : File.expand_path(path.to_s)
|
|
97
|
+
# uncompressed so JRuby Arrow Java can read without arrow-compression JARs
|
|
98
|
+
R.arrow___write_ipc_file(r_obj, path, compression: 'uncompressed')
|
|
99
|
+
File.open(path, 'rb') { |f| f.fsync }
|
|
100
|
+
path
|
|
101
|
+
end
|
|
102
|
+
|
|
66
103
|
# Open a Parquet/Feather directory or file as an Arrow Dataset
|
|
67
104
|
# using arrow::open_dataset().
|
|
68
105
|
#
|
data/lib/R_interface/rvector.rb
CHANGED
|
@@ -177,6 +177,21 @@ module R
|
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
+
# CRuby Enumerable#sum probes begin/end (range fast-path). R::Object#respond_to?
|
|
181
|
+
# always returns true, so that probe would hit method_missing and call R's begin.
|
|
182
|
+
# Implement sum in Ruby so MRI matches JRuby Enumerable behavior for blocks;
|
|
183
|
+
# without a block, forward to R's sum via method_missing.
|
|
184
|
+
def sum(*args, &block)
|
|
185
|
+
if block
|
|
186
|
+
::Kernel.raise(::ArgumentError, "wrong number of arguments (given #{args.size}, expected 0..1)") if args.size > 1
|
|
187
|
+
acc = args.empty? ? 0 : args[0]
|
|
188
|
+
each { |el| acc = acc + block.call(el) }
|
|
189
|
+
acc
|
|
190
|
+
else
|
|
191
|
+
method_missing(:sum, *args)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
180
195
|
#--------------------------------------------------------------------------------------
|
|
181
196
|
# Need to override each_with_index, as R indexing starts at 1
|
|
182
197
|
#--------------------------------------------------------------------------------------
|