galaaz 0.4.10 → 2.0.0
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 +26 -0
- data/LICENSE +0 -0
- data/README.md +3123 -882
- data/Rakefile +62 -41
- data/bin/galaaz-bootstrap +137 -0
- data/bin/galaaz-jruby +14 -0
- data/bin/galaaz_jruby_env.inc.sh +6 -0
- data/bin/gbookdown +64 -0
- data/bin/gknit +223 -6
- data/bin/gknit-draft +105 -0
- data/bin/gknit-draft.rb +28 -0
- data/bin/gknit_Rscript +127 -0
- data/bin/grun +27 -1
- data/bin/gstudio +49 -4
- data/bin/{gstudio.rb → gstudio_irb.rb} +0 -0
- data/bin/gstudio_pry.rb +7 -0
- data/bin/install-tinytex +6 -0
- data/bin/run_all_rspec +43 -0
- data/bin/run_example +14 -0
- data/bin/run_old_rspec +19 -0
- data/bin/run_rspec +23 -0
- data/bin/run_rspec_subset +38 -0
- data/bin/run_slow_rspec +19 -0
- data/blogs/R-on-Rails-Planning-Document.md +940 -0
- data/blogs/README.md +100 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +38 -66
- data/blogs/galaaz_ggplot/galaaz_ggplot.log +754 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.md +364 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.tex +607 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/midwest.Rmd +3 -3
- data/blogs/galaaz_ggplot/midwest_external_png +0 -0
- data/blogs/gknit/gknit.Rmd +52 -55
- data/blogs/gknit/gknit.md +94 -94
- data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
- data/blogs/gknit/lst.rds +0 -0
- data/blogs/gknit/model.rb +1 -1
- data/blogs/gknit/stats.bib +0 -0
- data/blogs/manual/include_model_local_repro.Rmd +14 -0
- data/blogs/manual/include_model_local_repro.md +75 -0
- data/blogs/manual/lst.rds +0 -0
- data/blogs/manual/manual.Rmd +1582 -196
- data/blogs/manual/manual.log +1786 -0
- data/blogs/manual/manual.md +3107 -890
- data/blogs/manual/manual.tex +3018 -1086
- data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-html/diverging_bar.png +0 -0
- data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
- data/blogs/manual/model.rb +41 -0
- data/blogs/nse_dplyr/nse_dplyr.Rmd +277 -151
- data/blogs/nse_dplyr/nse_dplyr.log +928 -0
- data/blogs/nse_dplyr/nse_dplyr.md +457 -293
- data/blogs/oh_my/not_so.rb +0 -0
- data/blogs/oh_my/oh_my.Rmd +1234 -25
- data/blogs/oh_my/oh_my.log +804 -0
- data/blogs/oh_my/oh_my.md +1808 -228
- data/blogs/oh_my/oh_my.tex +821 -0
- data/blogs/oh_my/old.Rmd +15 -14
- data/blogs/ruby_plot/ruby_plot.Rmd +58 -82
- data/blogs/ruby_plot/ruby_plot.log +885 -0
- data/blogs/ruby_plot/ruby_plot.md +71 -103
- data/blogs/ruby_plot/ruby_plot.tex +940 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/blogs/test/test.Rmd +14 -0
- data/examples/50Plots_MasterList/Images/midwest-scatterplot.PNG +0 -0
- data/examples/50Plots_MasterList/ScatterPlot.rb +0 -0
- data/examples/50Plots_MasterList/scatter_plot.rb +0 -0
- data/examples/Bibliography/master.bib +50 -0
- data/examples/Bibliography/stats.bib +72 -0
- data/examples/R/calc.R +0 -0
- data/examples/R/java_interop.R +0 -0
- data/examples/bioconductor_deseq2_airway/Documentation/DESeq2-airway-walkthrough.md +56 -0
- data/examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb +53 -0
- data/examples/bioconductor_deseq2_airway/bench_r_three_same_process.R +34 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb +33 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz_optimized.rb +34 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_minimal.R +30 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_pipeline_for_bench.R +36 -0
- data/examples/islr/all.rb +13 -0
- data/examples/islr/ch2.spec.rb +37 -7
- data/examples/islr/ch3.spec.rb +11 -2
- data/examples/islr/ch3_boston.rb +27 -0
- data/examples/islr/ch3_multiple_regression.rb +0 -0
- data/examples/islr/ch6.spec.rb +24 -1
- data/examples/islr/x_y_rnorm.jpg +0 -0
- data/examples/latex_templates/Test-acm_article/Makefile +16 -0
- data/examples/latex_templates/Test-acm_article/Test-acm_article.Rmd +65 -0
- data/examples/latex_templates/Test-acm_article/acm_proc_article-sp.cls +1670 -0
- data/examples/latex_templates/Test-acm_article/sensys-abstract.cls +703 -0
- data/examples/latex_templates/Test-acm_article/sigproc.bib +59 -0
- data/examples/latex_templates/Test-acs_article/Test-acs_article.Rmd +260 -0
- data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +11 -0
- data/examples/latex_templates/Test-acs_article/acs-my_output.bib +11 -0
- data/examples/latex_templates/Test-acs_article/acstest.bib +17 -0
- data/examples/latex_templates/Test-aea_article/AEA.cls +1414 -0
- data/{blogs/gknit/marshal.dump → examples/latex_templates/Test-aea_article/BibFile.bib} +0 -0
- data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +108 -0
- data/examples/latex_templates/Test-aea_article/aea.bst +1269 -0
- data/examples/latex_templates/Test-aea_article/multicol.sty +853 -0
- data/examples/latex_templates/Test-aea_article/references.bib +0 -0
- data/examples/latex_templates/Test-aea_article/setspace.sty +546 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +256 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +3397 -0
- data/examples/latex_templates/Test-ams_article/Test-ams_article.Rmd +215 -0
- data/examples/latex_templates/Test-ams_article/amstest.bib +436 -0
- data/examples/latex_templates/Test-asa_article/Test-asa_article.Rmd +153 -0
- data/examples/latex_templates/Test-asa_article/agsm.bst +1353 -0
- data/examples/latex_templates/Test-asa_article/bibliography.bib +233 -0
- data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +2409 -0
- data/examples/latex_templates/Test-ieee_article/IEEEtran.cls +6346 -0
- data/examples/latex_templates/Test-ieee_article/Test-ieee_article.Rmd +175 -0
- data/examples/latex_templates/Test-ieee_article/mybibfile.bib +20 -0
- data/examples/latex_templates/Test-rjournal_article/RJournal.sty +335 -0
- data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +18 -0
- data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +52 -0
- data/examples/latex_templates/Test-springer_article/Test-springer_article.Rmd +65 -0
- data/examples/latex_templates/Test-springer_article/bibliography.bib +26 -0
- data/examples/latex_templates/Test-springer_article/spbasic.bst +1658 -0
- data/examples/latex_templates/Test-springer_article/spmpsci.bst +1512 -0
- data/examples/latex_templates/Test-springer_article/spphys.bst +1443 -0
- data/examples/latex_templates/Test-springer_article/svglov3.clo +113 -0
- data/examples/latex_templates/Test-springer_article/svjour3.cls +1431 -0
- data/examples/misc/baseball.csv +0 -0
- data/examples/misc/ggplot.rb +3 -2
- data/examples/misc/moneyball.rb +0 -0
- data/examples/misc/subsetting.rb +0 -0
- data/examples/multithread_shards_to_r/shards_to_r.rb +67 -0
- data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.Rmd +73 -0
- data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +382 -0
- data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +164 -0
- data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +92 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +482 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +280 -0
- data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +386 -0
- data/examples/sthda_ggplot/README.md +0 -0
- data/examples/sthda_ggplot/RUN.md +41 -0
- data/examples/sthda_ggplot/all.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/density_gg.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_area.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_density.rb +2 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_dotplot.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_freqpoly.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_histogram.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/histogram_density.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/stat.rb +0 -0
- data/examples/sthda_ggplot/one_variable_discrete/bar.rb +0 -0
- data/examples/sthda_ggplot/qplots/box_violin_dot.rb +0 -0
- data/examples/sthda_ggplot/qplots/scatter_plots.rb +0 -0
- data/examples/sthda_ggplot/scatter_gg.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_bin2d.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_density2d.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_hex.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_point.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_smooth.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/misc.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_function/geom_area.rb +4 -3
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_bar.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_boxplot.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_dotplot.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_jitter.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_line.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_violin.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_disc/geom_jitter.rb +0 -0
- data/examples/sthda_ggplot/two_variables_error/geom_crossbar.rb +0 -0
- data/ext/new_bridge/Makefile +46 -0
- data/ext/new_bridge/galaaz_gatekeeper_phase0.cpp +12 -0
- data/ext/new_bridge/galaaz_gatekeeper_phase1.cpp +1639 -0
- data/lib/R_interface/galaaz_device.R +20 -0
- data/lib/R_interface/include_engine.R +109 -0
- data/lib/R_interface/new_bridge_adapter.rb +824 -0
- data/lib/R_interface/r.rb +177 -25
- data/lib/R_interface/r_arrow.rb +113 -0
- data/lib/R_interface/r_libs.R +4 -4
- data/lib/R_interface/r_methods.rb +13 -116
- data/lib/R_interface/r_module_s.rb +0 -0
- data/lib/R_interface/rbinary_operators.rb +20 -2
- data/lib/R_interface/rclosure.rb +5 -1
- data/lib/R_interface/rdata_frame.rb +34 -70
- data/lib/R_interface/rdevice.rb +125 -0
- data/lib/R_interface/rdevices.R +0 -0
- data/lib/R_interface/renvironment.rb +10 -4
- data/lib/R_interface/rexpression.rb +5 -1
- data/lib/R_interface/rindexed_object.rb +41 -13
- data/lib/R_interface/rlanguage.rb +20 -62
- data/lib/R_interface/rlist.rb +115 -25
- data/lib/R_interface/rlogical_operators.rb +0 -0
- data/lib/R_interface/rmatrix.rb +2 -11
- data/lib/R_interface/rmd_indexed_object.rb +5 -1
- data/lib/R_interface/robject.rb +348 -290
- data/lib/R_interface/rpkg.rb +1 -0
- data/lib/R_interface/rsupport.rb +610 -331
- data/lib/R_interface/rsupport_scope.rb +2 -1
- data/lib/R_interface/rsymbol.rb +50 -0
- data/lib/R_interface/ruby_callback.rb +2 -3
- data/lib/R_interface/ruby_extensions.rb +225 -175
- data/lib/R_interface/runary_operators.rb +0 -0
- data/lib/R_interface/rvector.rb +147 -31
- data/lib/galaaz.rb +0 -0
- data/lib/galaaz_jruby.rb +22 -0
- data/lib/gknit/diagnostics.rb +50 -0
- data/lib/gknit/draft.rb +111 -0
- data/lib/gknit/include_engine.rb +15 -7
- data/lib/gknit/knitr_engine.rb +223 -107
- data/lib/gknit/rb_engine.rb +3 -3
- data/lib/gknit/ruby_engine.rb +0 -0
- data/lib/gknit.rb +3 -0
- data/lib/new_bridge/bootstrap/windows_bootstrap.rb +285 -0
- data/lib/new_bridge/envelope.rb +51 -0
- data/lib/new_bridge/eval_result.rb +26 -0
- data/lib/new_bridge/framing.rb +39 -0
- data/lib/new_bridge/instance_pool_client.rb +38 -0
- data/lib/new_bridge/r_instance_manager.rb +404 -0
- data/lib/new_bridge/session_client.rb +530 -0
- data/lib/new_bridge/tcp_framed.rb +44 -0
- data/lib/new_bridge.rb +9 -0
- data/lib/util/exec_ruby.rb +95 -46
- data/lib/util/inline_file.rb +35 -30
- data/new_bridge_specs/benchmark_phase5_5_unboxing_spec.rb +96 -0
- data/new_bridge_specs/eval_r_async_spec.rb +113 -0
- data/new_bridge_specs/integration_phase5_1_concurrent_spec.rb +50 -0
- data/new_bridge_specs/integration_phase5_1_eval_spec.rb +16 -0
- data/new_bridge_specs/integration_phase5_1_r_api_spec.rb +25 -0
- data/new_bridge_specs/integration_phase5_1_smoke_spec.rb +31 -0
- data/new_bridge_specs/integration_phase5_2_dataframe_unboxing_spec.rb +19 -0
- data/new_bridge_specs/integration_phase5_2_handle_eval_unboxing_spec.rb +25 -0
- data/new_bridge_specs/integration_phase5_3_callback_args_spec.rb +28 -0
- data/new_bridge_specs/integration_phase5_3_callback_error_spec.rb +22 -0
- data/new_bridge_specs/integration_phase5_3_callback_timeout_spec.rb +28 -0
- data/new_bridge_specs/integration_phase5_3_callbacks_smoke_spec.rb +22 -0
- data/new_bridge_specs/integration_phase5_3_edge_cases_spec.rb +52 -0
- data/new_bridge_specs/integration_phase5_3_nested_spec.rb +30 -0
- data/new_bridge_specs/integration_phase5_4_concurrent_sessions_spec.rb +53 -0
- data/new_bridge_specs/integration_phase5_4_nested_session_callbacks_spec.rb +49 -0
- data/new_bridge_specs/integration_phase5_4_session_routing_spec.rb +38 -0
- data/new_bridge_specs/integration_phase5_5_stress_concurrency_spec.rb +52 -0
- data/new_bridge_specs/integration_phase5_5_unbox_walk_spec.rb +46 -0
- data/new_bridge_specs/phase0_protocol_spec.rb +96 -0
- data/new_bridge_specs/phase1_req_ret_spec.rb +66 -0
- data/new_bridge_specs/phase2_multi_instance_spec.rb +67 -0
- data/new_bridge_specs/phase3_callbacks_spec.rb +71 -0
- data/new_bridge_specs/phase4_2_hardening_spec.rb +252 -0
- data/new_bridge_specs/phase4_3_r_instance_manager_spec.rb +85 -0
- data/new_bridge_specs/phase4_nested_callbacks_spec.rb +123 -0
- data/r_requires/ggplot.rb +0 -0
- data/r_requires/knitr.rb +0 -0
- data/specs/all.rb +15 -11
- data/specs/arrow_from_ruby_batches_spec.rb +50 -0
- data/specs/arrow_semantics_spec.rb +64 -0
- data/specs/bridge_concurrent_spec.rb +46 -0
- data/specs/bridge_nested_spec.rb +25 -0
- data/specs/dataframe_semantics_spec.rb +122 -0
- data/specs/dataframe_single_index_logical_filter_spec.rb +21 -0
- data/specs/dispatch_probe_cache_spec.rb +38 -0
- data/specs/dispatch_probe_error_class_fallback_spec.rb +20 -0
- data/specs/dispatch_probe_fallback_spec.rb +18 -0
- data/specs/environment_semantics_spec.rb +89 -0
- data/specs/field_access_spec.rb +31 -0
- data/specs/figures/bg.jpeg +0 -0
- data/specs/figures/bg.png +0 -0
- data/specs/figures/bg.svg +168 -57
- data/specs/figures/dose_len.png +0 -0
- data/specs/figures/no_args.jpeg +0 -0
- data/specs/figures/no_args.png +0 -0
- data/specs/figures/no_args.svg +168 -57
- data/specs/figures/width_height.jpeg +0 -0
- data/specs/figures/width_height.png +0 -0
- data/specs/figures/width_height_units1.jpeg +0 -0
- data/specs/figures/width_height_units1.png +0 -0
- data/specs/figures/width_height_units2.jpeg +0 -0
- data/specs/figures/width_height_units2.png +0 -0
- data/specs/formula_semantics_spec.rb +81 -0
- data/specs/galaaz_util_exec_ruby_spec.rb +85 -0
- data/specs/galaaz_util_inline_file_spec.rb +54 -0
- data/specs/gknit_cli_option_permutation_spec.rb +24 -0
- data/specs/gknit_include_engine_spec.rb +72 -0
- data/specs/gknit_install_timeout_report_spec.rb +69 -0
- data/specs/gknit_internal_error_report_spec.rb +57 -0
- data/specs/gknit_vector_map_output_spec.rb +59 -0
- data/specs/globalenv_guardrail_spec.rb +52 -0
- data/specs/language_expression_semantics_spec.rb +145 -0
- data/specs/list_semantics_spec.rb +111 -0
- data/specs/new_bridge_bulk_dataframe_transfer_spec.rb +44 -0
- data/specs/new_bridge_bulk_vector_transfer_spec.rb +73 -0
- data/specs/new_bridge_callback_timeout_spec.rb +69 -0
- data/specs/new_bridge_eval_r_fallback_spec.rb +55 -0
- data/specs/nil_null_spec.rb +42 -0
- data/specs/object_build_phase2_spec.rb +53 -0
- data/specs/phase1_callback_bridge_spec.rb +84 -0
- data/specs/phase2_gknit_generic_rendering_guardrail_spec.rb +46 -0
- data/specs/phase2_gknit_no_raw_code_leakage_spec.rb +43 -0
- data/specs/phase3_gknit_generic_graphics_capture_spec.rb +71 -0
- data/specs/plot_device_semantics_spec.rb +28 -0
- data/specs/plot_snapshot_semantics_spec.rb +58 -0
- data/specs/protocol_result_spec.rb +236 -0
- data/specs/r_batch_fail_fast_spec.rb +47 -0
- data/specs/r_bridge_bootstrap_spec.rb +11 -0
- data/specs/r_devices.spec.rb +1 -1
- data/specs/r_eval.spec.rb +16 -18
- data/specs/r_function.spec.rb +1 -1
- data/specs/r_instance_manager_spec.rb +285 -0
- data/specs/r_list_apply.spec.rb +15 -15
- data/specs/r_matrix.spec.rb +0 -0
- data/specs/r_nse.spec.rb +5 -5
- data/specs/r_object_send_dispatch_spec.rb +13 -0
- data/specs/r_vector_comparator_spec.rb +8 -0
- data/specs/r_vector_creation.spec.rb +0 -0
- data/specs/r_vector_functions.spec.rb +0 -0
- data/specs/r_vector_object.spec.rb +0 -0
- data/specs/r_vector_operators.spec.rb +0 -0
- data/specs/r_vector_structured_scalar_reads_spec.rb +35 -0
- data/specs/r_vector_subsetting.spec.rb +0 -0
- data/specs/range_helper_spec.rb +21 -0
- data/specs/rsupport_scope_spec.rb +28 -0
- data/specs/rsupport_var_name_thread_safety_spec.rb +24 -0
- data/specs/scalar_character_spec.rb +44 -0
- data/specs/scoped_symbol_dsl_refinement_spec.rb +40 -0
- data/specs/session_env_bridge_spec.rb +25 -0
- data/specs/simplecov_bootstrap_spec.rb +10 -0
- data/specs/spec_helper.rb +10 -0
- data/specs/tmp.rb +41 -20
- data/specs/unboxing_recursion_regression_spec.rb +30 -0
- data/specs/unboxing_spec.rb +49 -0
- data/specs/verify_callbacks.rb +42 -0
- data/sty/galaaz.sty +0 -0
- data/version.rb +1 -1
- metadata +239 -71
- data/blogs/galaaz_ggplot/galaaz_ggplot.aux +0 -41
- data/blogs/galaaz_ggplot/galaaz_ggplot.html +0 -705
- data/blogs/galaaz_ggplot/galaaz_ggplot.out +0 -10
- data/blogs/galaaz_ggplot/galaaz_ggplot.pdf +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/midwest_rb.pdf +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/scatter_plot_rb.pdf +0 -0
- data/blogs/galaaz_ggplot/midwest.html +0 -188
- data/blogs/gknit/gknit.html +0 -2266
- data/blogs/gknit/gknit.pdf +0 -0
- data/blogs/gknit/gknit.tex +0 -1358
- data/blogs/manual/graph.rb +0 -29
- data/blogs/manual/manual.html +0 -2995
- data/blogs/manual/manual.pdf +0 -0
- data/blogs/manual/manual_files/figure-latex/diverging_bar.pdf +0 -0
- data/blogs/nse_dplyr/nse_dplyr.html +0 -960
- data/blogs/nse_dplyr/nse_dplyr.pdf +0 -0
- data/blogs/nse_dplyr/nse_dplyr.tex +0 -1373
- data/blogs/oh_my/oh_my.html +0 -680
- data/blogs/ruby_plot/ruby_plot.Rmd_external_figs +0 -662
- data/blogs/ruby_plot/ruby_plot.html +0 -729
- data/blogs/ruby_plot/ruby_plot.pdf +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.svg +0 -57
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.svg +0 -106
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.svg +0 -110
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.svg +0 -174
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.svg +0 -236
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.svg +0 -296
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.svg +0 -236
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.svg +0 -218
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.svg +0 -128
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.svg +0 -150
- data/examples/paper/paper.rb +0 -36
- data/specs/r_dataframe.spec.rb +0 -379
- data/specs/r_environment.spec.rb +0 -140
- data/specs/r_formula.spec.rb +0 -232
- data/specs/r_language.spec.rb +0 -112
- data/specs/r_list.spec.rb +0 -293
- data/specs/r_plots.spec.rb +0 -72
- data/specs/ruby_expression.spec.rb +0 -315
|
@@ -3,8 +3,8 @@ title: "How to make Beautiful Ruby Plots with Galaaz"
|
|
|
3
3
|
author:
|
|
4
4
|
- "Rodrigo Botafogo"
|
|
5
5
|
- "Daniel Mossé - University of Pittsburgh"
|
|
6
|
-
tags: [Tech, Data Science, Ruby, R,
|
|
7
|
-
date: "November 19th, 2018"
|
|
6
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz]
|
|
7
|
+
date: "November 19th, 2018 (narrative updated for Galaaz 2.0, 2026)"
|
|
8
8
|
output:
|
|
9
9
|
html_document:
|
|
10
10
|
self_contained: true
|
|
@@ -41,42 +41,17 @@ of libraries for data analysis.
|
|
|
41
41
|
|
|
42
42
|
Until recently, there was no real perspective for Ruby to bridge this gap.
|
|
43
43
|
Implementing a complete scientific computing infrastructure would take too long.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
> values from one language to another. With GraalVM there is no copying or
|
|
56
|
-
> marshaling necessary as it is with other polyglot systems. This lets you
|
|
57
|
-
> achieve high performance when language boundaries are crossed. Most of the time
|
|
58
|
-
> there is no additional cost for crossing a language boundary at all.
|
|
59
|
-
>
|
|
60
|
-
> Often developers have to make uncomfortable compromises that require them
|
|
61
|
-
> to rewrite their software in other languages. For example:
|
|
62
|
-
>
|
|
63
|
-
> * That library is not available in my language. I need to rewrite it.
|
|
64
|
-
> * That language would be the perfect fit for my problem, but we cannot
|
|
65
|
-
> run it in our environment.
|
|
66
|
-
> * That problem is already solved in my language, but the language is
|
|
67
|
-
> too slow.
|
|
68
|
-
>
|
|
69
|
-
> With GraalVM we aim to allow developers to freely choose the right language for
|
|
70
|
-
> the task at hand without making compromises.
|
|
71
|
-
|
|
72
|
-
As stated above, GraalVM is a _universal_ virtual machine that allows Ruby and R (and other
|
|
73
|
-
languages) to run on the same environment. GraalVM allows polyglot applications to
|
|
74
|
-
_seamlessly_ interact with one another and pass values from one language to the other.
|
|
75
|
-
Although a great idea, GraalVM still requires application writers to know several languages.
|
|
76
|
-
To eliminate that requirement, we built Galaaz, a gem for Ruby, to tightly couple
|
|
77
|
-
Ruby and R and allow those languages to interact in a way that the user will be unaware
|
|
78
|
-
of such interaction. In other words, a Ruby programmer will be able to use all
|
|
79
|
-
the capabilities of R without knowing the R syntax.
|
|
44
|
+
|
|
45
|
+
**Galaaz 2.0** couples **[JRuby](https://www.jruby.org/)** (Ruby on the JVM) with **GNU R**—the
|
|
46
|
+
same R distribution used for data science everywhere. A **bridge** evaluates R from Ruby and
|
|
47
|
+
exchanges data between the two processes so that, from Ruby, you call R functions and work
|
|
48
|
+
with R objects using familiar Ruby syntax. In other words, a Ruby programmer can use the
|
|
49
|
+
capabilities of R without memorizing all of R’s syntax for day-to-day tasks.
|
|
50
|
+
|
|
51
|
+
An **earlier line of work** used Oracle’s **GraalVM** with **TruffleRuby** and **FastR** so that
|
|
52
|
+
Ruby and R could share one JVM runtime. That stack is **no longer** what Galaaz targets;
|
|
53
|
+
today’s Galaaz is developed and tested with **JRuby + GNU R** (see the project manual for setup
|
|
54
|
+
and command-line tools).
|
|
80
55
|
|
|
81
56
|
Library wrapping is a usual way of bringing features from one language into another.
|
|
82
57
|
To improve performance, Python often wraps more efficient C libraries. For the
|
|
@@ -105,7 +80,7 @@ ggplot themes that will work the same as the Ruby module. Yet, writing a new th
|
|
|
105
80
|
requires specific knowledge on theme writing. Ruby modules are standard to the
|
|
106
81
|
language and don't need special knowledge.
|
|
107
82
|
|
|
108
|
-
[Here](https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021)
|
|
83
|
+
[Here](https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021) is an older article (GraalVM-era Galaaz) with a scatter plot in Ruby; the **ideas** still apply under Galaaz 2.0 with JRuby and GNU R.
|
|
109
84
|
|
|
110
85
|
# gKnit
|
|
111
86
|
|
|
@@ -137,14 +112,14 @@ The ToothGrowth dataset contains three columns: 'len', 'supp' and 'dose'. Let's
|
|
|
137
112
|
take a look at a few rows of this dataset. In Galaaz, R variables are accessed
|
|
138
113
|
by using the corresponding Ruby symbol preceeded by the tilda ('~') function. Note in the
|
|
139
114
|
following chunk that 'ToothGrowth' is the R variable and Ruby's 'tooth_growth' is
|
|
140
|
-
assigned the value of '
|
|
115
|
+
assigned the value of '~R[:ToothGrowth]'.
|
|
141
116
|
|
|
142
117
|
|
|
143
|
-
```ruby
|
|
118
|
+
``` ruby
|
|
144
119
|
# Read the R ToothGrowth variable and assign it to the
|
|
145
120
|
# Ruby instance variable tooth_growth that will be
|
|
146
121
|
# available to all Ruby chunks in this document.
|
|
147
|
-
tooth_growth =
|
|
122
|
+
tooth_growth = ~R[:ToothGrowth]
|
|
148
123
|
# print the first few elements of the dataset
|
|
149
124
|
puts tooth_growth.head
|
|
150
125
|
```
|
|
@@ -165,7 +140,7 @@ with a dot ('.') and the name of the column. Also use dot notation to chain meth
|
|
|
165
140
|
in usual Ruby style.
|
|
166
141
|
|
|
167
142
|
|
|
168
|
-
```ruby
|
|
143
|
+
``` ruby
|
|
169
144
|
# Access the tooth_growth 'len' column and print the first few
|
|
170
145
|
# elements of this column with the 'head' method.
|
|
171
146
|
puts tooth_growth.len.head
|
|
@@ -183,7 +158,7 @@ function from Galaaz the dot ('.') in the function name is substituted by '__' (
|
|
|
183
158
|
The function 'as.factor' becomes 'R.as__factor' or just 'as__factor' when chaining.
|
|
184
159
|
|
|
185
160
|
|
|
186
|
-
```ruby
|
|
161
|
+
``` ruby
|
|
187
162
|
# convert the dose to a factor
|
|
188
163
|
tooth_growth.dose = tooth_growth.dose.as__factor
|
|
189
164
|
```
|
|
@@ -192,7 +167,7 @@ Let's explore some more details of this dataset. In particular, let's look at i
|
|
|
192
167
|
structure and summary statistics.
|
|
193
168
|
|
|
194
169
|
|
|
195
|
-
```ruby
|
|
170
|
+
``` ruby
|
|
196
171
|
puts tooth_growth.dim
|
|
197
172
|
```
|
|
198
173
|
|
|
@@ -207,23 +182,16 @@ functions does not return anything and prints the structure of the dataset
|
|
|
207
182
|
as a side effect.
|
|
208
183
|
|
|
209
184
|
|
|
210
|
-
```ruby
|
|
185
|
+
``` ruby
|
|
211
186
|
tooth_growth.str
|
|
212
187
|
```
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
## 'data.frame': 60 obs. of 3 variables:
|
|
216
|
-
## $ len : num 4.2 11.5 7.3 5.8 6.4 10 11.2 11.2 5.2 7 ...
|
|
217
|
-
## $ supp: Factor w/ 2 levels "OJ","VC": 2 2 2 2 2 2 2 2 2 2 ...
|
|
218
|
-
## $ dose: Factor w/ 3 levels "0.5","1","2": 1 1 1 1 1 1 1 1 1 1 ...
|
|
219
|
-
```
|
|
220
188
|
Observe that both variables 'supp' and 'dose' are factors. The system made variable 'supp'
|
|
221
189
|
a factor automatically, since it contais two strings OJ and VC.
|
|
222
190
|
|
|
223
191
|
Finally, using the summary method, we get the statistical summary for the dataset
|
|
224
192
|
|
|
225
193
|
|
|
226
|
-
```ruby
|
|
194
|
+
``` ruby
|
|
227
195
|
puts tooth_growth.summary
|
|
228
196
|
```
|
|
229
197
|
|
|
@@ -264,14 +232,14 @@ the $y$ axis: 'E.aes(x: :dose, y: :len)'. To specify the type of plot add a geo
|
|
|
264
232
|
the plot. For a boxplot, the geom is R.geom_boxplot.
|
|
265
233
|
|
|
266
234
|
|
|
267
|
-
```ruby
|
|
235
|
+
``` ruby
|
|
268
236
|
require 'ggplot'
|
|
269
237
|
|
|
270
238
|
e = tooth_growth.ggplot(E.aes(x: :dose, y: :len))
|
|
271
239
|
print e + R.geom_boxplot
|
|
272
240
|
```
|
|
273
241
|
|
|
274
|
-

|
|
275
243
|
|
|
276
244
|
Great! We've just managed to create and save our first plot in Ruby with only
|
|
277
245
|
four lines of code. We can now easily see with this plot a clear trend: as the
|
|
@@ -293,31 +261,30 @@ the 'facet_grid' method is a [_formula_](https://thomasleeper.com/Rcourse/Tutori
|
|
|
293
261
|
|
|
294
262
|
In Galaaz we give programmers the flexibility to use two different ways to write formulas.
|
|
295
263
|
In the first way, we use Ruby expressions and the '.til' function. The formula 'x ~ y', becomes
|
|
296
|
-
':x.til :y'. More information on expressions can be found in [Galaaz Manual](https://www.rubydoc.info/gems/galaaz/).
|
|
264
|
+
'R[:x].til :y'. More information on expressions can be found in [Galaaz Manual](https://www.rubydoc.info/gems/galaaz/).
|
|
297
265
|
|
|
298
266
|
|
|
299
267
|
Another way of writing a formula is to use the 'formula' function with the actual formula as
|
|
300
268
|
a string. The formula ```x ~ y``` in R can be written as ```R.formula("x ~ y")```. For more
|
|
301
269
|
complex formulas, the use of the 'formula' function is preferred.
|
|
302
270
|
|
|
303
|
-
The formula
|
|
271
|
+
The formula ```R[:all].til :supp``` indicates to the 'facet_grid' function that it needs to
|
|
304
272
|
facet the plot based on the ```supp``` variable and split the plot vertically. Changing
|
|
305
|
-
the formula to
|
|
306
|
-
|
|
273
|
+
the formula to ```R[:supp].til :all``` would split the plot horizontally.
|
|
307
274
|
|
|
308
|
-
```ruby
|
|
309
275
|
|
|
276
|
+
``` ruby
|
|
310
277
|
base_tooth = tooth_growth.ggplot(E.aes(x: :dose, y: :len, group: :dose))
|
|
311
278
|
|
|
312
279
|
bp = base_tooth + R.geom_boxplot +
|
|
313
280
|
# Split in vertical direction
|
|
314
|
-
R.facet_grid(:all.til :supp)
|
|
315
|
-
|
|
281
|
+
R.facet_grid(R[:all].til :supp)
|
|
282
|
+
|
|
316
283
|
puts bp
|
|
317
284
|
```
|
|
318
285
|
|
|
319
286
|
|
|
320
|
-

|
|
321
288
|
|
|
322
289
|
It now becomes clear that although both methods of delivery have a direct
|
|
323
290
|
impact on tooth growth, method (OJ) is non-linear having a higher impact with smaller
|
|
@@ -334,13 +301,13 @@ enough to add ```fill: :dose``` to the aesthetic of boxplot. With this command
|
|
|
334
301
|
factor gets its own color.
|
|
335
302
|
|
|
336
303
|
|
|
337
|
-
```ruby
|
|
304
|
+
``` ruby
|
|
338
305
|
bp = bp + R.geom_boxplot(E.aes(fill: :dose))
|
|
339
306
|
puts bp
|
|
340
307
|
```
|
|
341
308
|
|
|
342
309
|
|
|
343
|
-

|
|
344
311
|
|
|
345
312
|
Facetting helps us compare the general trends for each delivery method.
|
|
346
313
|
Adding color allow us to compare specifically how each dosage impacts the tooth growth.
|
|
@@ -372,7 +339,7 @@ each of the 60 pigs in the experiment. For that, add the function 'R.geom_point
|
|
|
372
339
|
plot.
|
|
373
340
|
|
|
374
341
|
|
|
375
|
-
```ruby
|
|
342
|
+
``` ruby
|
|
376
343
|
# Split in vertical direction
|
|
377
344
|
bp = bp + R.geom_point
|
|
378
345
|
|
|
@@ -380,7 +347,7 @@ puts bp
|
|
|
380
347
|
```
|
|
381
348
|
|
|
382
349
|
|
|
383
|
-

|
|
384
351
|
|
|
385
352
|
Now we can see the actual distribution of all the 60 subjects. Actually, this is not
|
|
386
353
|
totally true. We have a hard time seing all 60 subjects. It seems that some points
|
|
@@ -394,13 +361,13 @@ prevents data hiding. We also add
|
|
|
394
361
|
color and change the shape of the points, making them even easier to see.
|
|
395
362
|
|
|
396
363
|
|
|
397
|
-
```ruby
|
|
364
|
+
``` ruby
|
|
398
365
|
# Split in vertical direction
|
|
399
366
|
puts bp + R.geom_jitter(shape: 23, color: "cyan3", size: 1)
|
|
400
367
|
```
|
|
401
368
|
|
|
402
369
|
|
|
403
|
-

|
|
404
371
|
|
|
405
372
|
Now we can see all 60 points in the graph. We have here a much higher information density
|
|
406
373
|
and we can see outliers and subjects distribution.
|
|
@@ -436,7 +403,7 @@ This ordering seems more natural and
|
|
|
436
403
|
matches with the actual order of the colors in the plot.
|
|
437
404
|
|
|
438
405
|
|
|
439
|
-
```ruby
|
|
406
|
+
``` ruby
|
|
440
407
|
bp = bp +
|
|
441
408
|
R.scale_fill_manual(values: R.c("cyan", "deepskyblue", "deepskyblue4"),
|
|
442
409
|
breaks: R.c("2","1","0.5"))
|
|
@@ -445,7 +412,7 @@ puts bp
|
|
|
445
412
|
```
|
|
446
413
|
|
|
447
414
|
|
|
448
|
-

|
|
449
416
|
|
|
450
417
|
## Violin Plot and Jitter
|
|
451
418
|
|
|
@@ -465,9 +432,9 @@ a boxplot known as a _violin plot_ with jittered data.
|
|
|
465
432
|
> The central dot represents the median average value.
|
|
466
433
|
|
|
467
434
|
|
|
468
|
-
```ruby
|
|
435
|
+
``` ruby
|
|
469
436
|
violin = base_tooth + R.geom_violin(E.aes(fill: :dose)) +
|
|
470
|
-
R.facet_grid(:all.til :supp) +
|
|
437
|
+
R.facet_grid(R[:all].til :supp) +
|
|
471
438
|
R.geom_jitter(shape: 23, color: "cyan3", size: 1) +
|
|
472
439
|
R.scale_fill_manual(values: R.c("cyan", "deepskyblue", "deepskyblue4"),
|
|
473
440
|
breaks: R.c("2","1","0.5"))
|
|
@@ -476,7 +443,7 @@ puts violin
|
|
|
476
443
|
```
|
|
477
444
|
|
|
478
445
|
|
|
479
|
-

|
|
480
447
|
|
|
481
448
|
This plot is an alternative to the original boxplot. For the final presentation, it is
|
|
482
449
|
important to think which graphics will be best understood by our audience. A violin plot
|
|
@@ -497,7 +464,7 @@ for information about the plot (for clarity, we defined a caption variable using
|
|
|
497
464
|
Here Doc style).
|
|
498
465
|
|
|
499
466
|
|
|
500
|
-
```ruby
|
|
467
|
+
``` ruby
|
|
501
468
|
caption = <<-EOT
|
|
502
469
|
Length of odontoblasts in 60 guinea pigs.
|
|
503
470
|
Each animal received one of three dose levels of vitamin C.
|
|
@@ -513,7 +480,7 @@ puts bp + decorations
|
|
|
513
480
|
```
|
|
514
481
|
|
|
515
482
|
|
|
516
|
-

|
|
517
484
|
|
|
518
485
|
## The Corp Theme
|
|
519
486
|
|
|
@@ -531,7 +498,7 @@ a shade o blue (color: '#00080'). Axis labels are moved near the end of the axi
|
|
|
531
498
|
written in 'bold'.
|
|
532
499
|
|
|
533
500
|
|
|
534
|
-
```ruby
|
|
501
|
+
``` ruby
|
|
535
502
|
module CorpTheme
|
|
536
503
|
|
|
537
504
|
R.install_and_loads 'RColorBrewer'
|
|
@@ -595,23 +562,23 @@ the decorations ('decorations'), plus the corporate theme.
|
|
|
595
562
|
Here is our final boxplot, without jitter.
|
|
596
563
|
|
|
597
564
|
|
|
598
|
-
```ruby
|
|
565
|
+
``` ruby
|
|
599
566
|
puts bp + decorations + CorpTheme.global_theme(faceted: true)
|
|
600
567
|
```
|
|
601
568
|
|
|
602
569
|
|
|
603
|
-

|
|
604
571
|
|
|
605
572
|
And here is the final violin plot, with jitter and the same look and feel of the corporate
|
|
606
573
|
boxplot.
|
|
607
574
|
|
|
608
575
|
|
|
609
|
-
```ruby
|
|
576
|
+
``` ruby
|
|
610
577
|
puts violin + decorations + CorpTheme.global_theme(faceted: true)
|
|
611
578
|
```
|
|
612
579
|
|
|
613
580
|
|
|
614
|
-

|
|
615
582
|
|
|
616
583
|
## Another View
|
|
617
584
|
|
|
@@ -620,14 +587,14 @@ dose and not by supplement. This shows how easy it is to create new plots by ju
|
|
|
620
587
|
changing small statement on the _grammar of graphics_.
|
|
621
588
|
|
|
622
589
|
|
|
623
|
-
```ruby
|
|
590
|
+
``` ruby
|
|
624
591
|
caption = <<-EOT
|
|
625
592
|
Length of odontoblasts in 60 guinea pigs.
|
|
626
593
|
Each animal received one of three dose levels of vitamin C.
|
|
627
594
|
EOT
|
|
628
595
|
|
|
629
596
|
bp = tooth_growth.ggplot(E.aes(x: :supp, y: :len, group: :supp)) +
|
|
630
|
-
R.geom_boxplot(E.aes(fill: :supp)) + R.facet_grid(:all.til :dose) +
|
|
597
|
+
R.geom_boxplot(E.aes(fill: :supp)) + R.facet_grid(R[:all].til :dose) +
|
|
631
598
|
R.scale_fill_manual(values: R.c("cyan", "deepskyblue4")) +
|
|
632
599
|
R.labs(title: "Tooth Growth: Length by Dose",
|
|
633
600
|
subtitle: "Faceted by dose",
|
|
@@ -639,7 +606,7 @@ puts bp
|
|
|
639
606
|
```
|
|
640
607
|
|
|
641
608
|
|
|
642
|
-

|
|
643
610
|
|
|
644
611
|
# Conclusion
|
|
645
612
|
|
|
@@ -651,18 +618,17 @@ developer, migration to Ruby is a matter of small syntactic changes with a very
|
|
|
651
618
|
learning curve. As the R developer becomes more proficient in Ruby, he can start using
|
|
652
619
|
'classes', 'modules', 'procs', 'lambdas'.
|
|
653
620
|
|
|
654
|
-
Trying to bring to Ruby the power of R starting from scratch is an
|
|
621
|
+
Trying to bring to Ruby the power of R starting from scratch is an enormous endeavour
|
|
655
622
|
and would probably never be accomplished. Today's data scientists would certainly
|
|
656
623
|
stick with either Python or R. Now, both the Ruby and R communities can benefit
|
|
657
|
-
from this marriage
|
|
658
|
-
|
|
659
|
-
the process to couple Ruby and R
|
|
660
|
-
|
|
661
|
-
be extremely relevant.
|
|
624
|
+
from this marriage: **Galaaz 2.0** uses **standard GNU R** for statistics and graphics
|
|
625
|
+
and **JRuby** for application code, threading, and the JVM ecosystem. We presented
|
|
626
|
+
the process to couple Ruby and R; the coupling is implemented by the Galaaz bridge and
|
|
627
|
+
**gKnit** for literate documents, not by a single GraalVM polyglot runtime.
|
|
662
628
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
629
|
+
For performance, expect **ordinary GNU R** behaviour for model fitting and plotting, while
|
|
630
|
+
**JRuby** gives **real parallel threads** on the Ruby side and access to Java libraries when
|
|
631
|
+
you need them.
|
|
666
632
|
|
|
667
633
|
This article has shown how to improve a plot step-by-step. Starting from a very simple
|
|
668
634
|
boxplot with all default configurations, we moved slowly to our final plot. The important
|
|
@@ -676,11 +642,11 @@ be of great help for any Rubyist trying to write articles, blogs or documentatio
|
|
|
676
642
|
|
|
677
643
|
# Installing Galaaz
|
|
678
644
|
|
|
679
|
-
## Prerequisites
|
|
645
|
+
## Prerequisites (Galaaz 2.0)
|
|
680
646
|
|
|
681
|
-
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
647
|
+
* **JRuby** — Ruby on the JVM ([jruby.org](https://www.jruby.org/))
|
|
648
|
+
* A **JDK** compatible with your JRuby version
|
|
649
|
+
* **GNU R** — `R` on your `PATH`, with compilers/tools available if packages must be built from source
|
|
684
650
|
|
|
685
651
|
The following R packages will be automatically installed when necessary, but could be installed prior
|
|
686
652
|
to using gKnit if desired:
|
|
@@ -689,14 +655,16 @@ to using gKnit if desired:
|
|
|
689
655
|
* gridExtra
|
|
690
656
|
* knitr
|
|
691
657
|
|
|
692
|
-
Installation of R packages requires a development environment and can be time consuming.
|
|
693
|
-
the
|
|
658
|
+
Installation of R packages requires a development environment and can be time consuming. On Linux,
|
|
659
|
+
the usual build tools (e.g. a C/C++ compiler) are typically enough. On macOS, Xcode command-line tools
|
|
660
|
+
are commonly required.
|
|
694
661
|
|
|
695
662
|
## Preparation
|
|
696
663
|
|
|
697
|
-
* gem
|
|
664
|
+
* Install the **galaaz** gem (from RubyGems when published, or `gem build` / `path:` from a checkout).
|
|
698
665
|
|
|
699
666
|
## Usage
|
|
700
667
|
|
|
701
|
-
* gknit
|
|
702
|
-
* In
|
|
668
|
+
* From the Galaaz repository (or your installed layout), render documents with **`bin/gknit`** (see the project manual for flags such as `--output_format all`).
|
|
669
|
+
* In Ruby code: `require 'galaaz'`
|
|
670
|
+
* For running scripts with the correct JRuby and JVM options, use **`bin/galaaz-jruby`** as described in the manual.
|