galaaz 0.5.0 → 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 +1360 -636
- data/Rakefile +61 -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 +84 -13
- data/bin/gknit-draft.rb +0 -0
- data/bin/gstudio +5 -3
- data/bin/gstudio_irb.rb +0 -0
- data/bin/gstudio_pry.rb +0 -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 +115 -155
- 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 +47 -52
- data/blogs/gknit/gknit.md +1430 -0
- 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 +852 -239
- data/blogs/manual/manual.log +1786 -0
- data/blogs/manual/manual.md +1360 -636
- data/blogs/manual/manual.tex +1883 -1161
- 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 +1 -1
- data/blogs/nse_dplyr/nse_dplyr.Rmd +84 -111
- data/blogs/nse_dplyr/nse_dplyr.log +928 -0
- data/blogs/nse_dplyr/nse_dplyr.md +198 -229
- 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 +1663 -86
- 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 -102
- 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 +0 -0
- data/examples/Bibliography/stats.bib +0 -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/acm_proc_article-sp.cls +0 -0
- data/examples/latex_templates/Test-acm_article/sigproc.bib +0 -0
- data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +0 -0
- data/examples/latex_templates/Test-acs_article/acs-my_output.bib +0 -0
- data/examples/latex_templates/Test-aea_article/BibFile.bib +0 -0
- data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +0 -0
- data/examples/latex_templates/Test-aea_article/references.bib +0 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +0 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +0 -0
- data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +0 -0
- data/examples/latex_templates/Test-ieee_article/mybibfile.bib +0 -0
- data/examples/latex_templates/Test-rjournal_article/RJournal.sty +0 -0
- data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +0 -0
- data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +0 -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 +0 -0
- data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +0 -0
- data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +0 -0
- data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +0 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +0 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +0 -0
- data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +0 -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 +3 -3
- data/lib/R_interface/r_methods.rb +13 -126
- 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 +0 -0
- data/lib/R_interface/rsupport.rb +609 -328
- 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 +23 -17
- data/lib/gknit/include_engine.rb +15 -7
- data/lib/gknit/knitr_engine.rb +223 -74
- data/lib/gknit/rb_engine.rb +3 -3
- data/lib/gknit/ruby_engine.rb +0 -0
- data/lib/gknit.rb +1 -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 -20
- 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 +0 -0
- 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 +194 -64
- data/blogs/galaaz_ggplot/galaaz_ggplot.html +0 -520
- data/blogs/galaaz_ggplot/galaaz_ggplot.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/manual/manual.html +0 -4638
- 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 -878
- data/blogs/nse_dplyr/nse_dplyr.pdf +0 -0
- data/blogs/oh_my/oh_my.html +0 -568
- data/blogs/ruby_plot/ruby_plot.html +0 -544
- data/blogs/ruby_plot/ruby_plot.pdf +0 -0
- data/examples/latex_templates/Test-acs_article/Test-acs_article.pdf +0 -0
- data/examples/latex_templates/Test-aea_article/Test-aea_article.pdf +0 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.pdf +0 -0
- data/examples/latex_templates/Test-amq_article/pics/Figure2.pdf +0 -0
- data/examples/latex_templates/Test-asa_article/Test-asa_article.pdf +0 -0
- data/examples/latex_templates/Test-ieee_article/Test-ieee_article.pdf +0 -0
- data/examples/latex_templates/Test-rjournal_article/RJwrapper.pdf +0 -0
- data/examples/latex_templates/Test-springer_article/Test-springer_article.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.pdf +0 -0
- 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 -316
data/lib/R_interface/rvector.rb
CHANGED
|
@@ -30,8 +30,12 @@ module R
|
|
|
30
30
|
include UnaryOperators
|
|
31
31
|
include ExecUniOp
|
|
32
32
|
include LogicalOperators
|
|
33
|
-
include Enumerable
|
|
34
|
-
|
|
33
|
+
include ::Enumerable
|
|
34
|
+
|
|
35
|
+
def class
|
|
36
|
+
::R::Vector
|
|
37
|
+
end
|
|
38
|
+
|
|
35
39
|
#--------------------------------------------------------------------------------------
|
|
36
40
|
#
|
|
37
41
|
#--------------------------------------------------------------------------------------
|
|
@@ -41,17 +45,62 @@ module R
|
|
|
41
45
|
end
|
|
42
46
|
|
|
43
47
|
#--------------------------------------------------------------------------------------
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
# to receive the actual number that can be used in a Ruby method. In this case, we
|
|
47
|
-
# use the '<<' operator.
|
|
48
|
-
# @return the Ruby element at the given index in the vector
|
|
48
|
+
# Unbox vector to Ruby. Atomic vectors: length 1 → scalar, length > 1 → Array of scalars.
|
|
49
|
+
# Recursion depth is checked; vectors do not recurse into R::Object (elements are scalars).
|
|
49
50
|
#--------------------------------------------------------------------------------------
|
|
51
|
+
def unboxed_get(index = nil, depth = 0)
|
|
52
|
+
if depth >= ::R::Support::MAX_UNBOX_DEPTH
|
|
53
|
+
::Kernel.raise(::R::UnboxDepthError, "unbox: list too deep (max depth #{::R::Support::MAX_UNBOX_DEPTH} exceeded)")
|
|
54
|
+
end
|
|
55
|
+
if index.nil?
|
|
56
|
+
arr = ::R.bridge.pull_vector(@r_interop)
|
|
57
|
+
return (arr.length == 1 ? arr[0] : arr)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# For indexed unboxing, use binary transport + result protocol (no printed-text parsing).
|
|
61
|
+
idx = index
|
|
62
|
+
len = atomic_vector_length
|
|
63
|
+
::Kernel.raise(::IndexError.new("index #{idx} out of array bounds: 0...#{len - 1}")) if idx >= len
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
type = atomic_vector_typeof
|
|
66
|
+
|
|
67
|
+
case type
|
|
68
|
+
when 'integer'
|
|
69
|
+
data = ::R.bridge.pull_integer_vector(@r_interop, 1, idx, 1)
|
|
70
|
+
data[0]
|
|
71
|
+
when 'character'
|
|
72
|
+
var_name = ::R::Support.generate_var_name
|
|
73
|
+
assignment = "#{var_name} <- #{@r_interop}[[#{idx + 1}]]"
|
|
74
|
+
envelope = ::R.bridge.eval_r_with_result(assignment)
|
|
75
|
+
raise "Result protocol: no envelope for character element #{@r_interop}[[#{idx + 1}]]" unless envelope
|
|
76
|
+
raise "Result protocol: expected scalar_character, got #{envelope[:type]}" unless envelope[:type] == :scalar_character
|
|
77
|
+
v = envelope[:value]
|
|
78
|
+
(v.is_a?(::String) && v =~ /^rb_obj_\d+$/) ? ::R::Support.get_ruby_object(v) : v
|
|
79
|
+
when 'logical'
|
|
80
|
+
var_name = ::R::Support.generate_var_name
|
|
81
|
+
assignment = "#{var_name} <- #{@r_interop}[[#{idx + 1}]]"
|
|
82
|
+
envelope = ::R.bridge.eval_r_with_result(assignment)
|
|
83
|
+
raise "Result protocol: no envelope for logical element #{@r_interop}[[#{idx + 1}]]" unless envelope
|
|
84
|
+
raise "Result protocol: expected scalar_logical, got #{envelope[:type]}" unless envelope[:type] == :scalar_logical
|
|
85
|
+
case envelope[:value]
|
|
86
|
+
when true then true
|
|
87
|
+
when false then false
|
|
88
|
+
else nil
|
|
89
|
+
end
|
|
90
|
+
else
|
|
91
|
+
data = ::R.bridge.pull_double_vector(@r_interop, 1, idx, 1)
|
|
92
|
+
data[0]
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
alias_method :>>, :unboxed_get
|
|
97
|
+
alias_method :<<, :unboxed_get
|
|
98
|
+
|
|
99
|
+
# Return Ruby array so RSpec/eq and array conversion don't forward to_ary to R.
|
|
100
|
+
# Must always return an Array (length-1 vector unboxes to scalar via >> nil, so wrap in [v]).
|
|
101
|
+
def to_ary
|
|
102
|
+
v = self >> nil
|
|
103
|
+
v.is_a?(::Array) ? v : [v]
|
|
55
104
|
end
|
|
56
105
|
|
|
57
106
|
#--------------------------------------------------------------------------------------
|
|
@@ -59,32 +108,73 @@ module R
|
|
|
59
108
|
#--------------------------------------------------------------------------------------
|
|
60
109
|
|
|
61
110
|
def pop
|
|
62
|
-
|
|
111
|
+
# Return unboxed first element as a Ruby scalar
|
|
112
|
+
unboxed_get(0)
|
|
63
113
|
end
|
|
64
114
|
|
|
65
|
-
|
|
66
|
-
# @bug
|
|
67
|
-
# Each cannot return a Enumerator because R is single threaded. When this restriction
|
|
68
|
-
# is removed, make each return self.to_enum
|
|
69
|
-
#--------------------------------------------------------------------------------------
|
|
115
|
+
CHUNK_SIZE = 1_000_000 # 1M rows per page
|
|
70
116
|
|
|
71
|
-
def
|
|
117
|
+
def stitch(halo: 0, &block)
|
|
118
|
+
len = atomic_vector_length
|
|
72
119
|
|
|
73
|
-
|
|
120
|
+
# 2. Allocate result vector in R
|
|
121
|
+
res_name = ::R::Support.generate_var_name
|
|
122
|
+
::R.bridge.eval_r("#{res_name} <- numeric(#{len})")
|
|
123
|
+
|
|
124
|
+
# 3. Process in chunks with Halo
|
|
125
|
+
offset = 0
|
|
126
|
+
while offset < len
|
|
127
|
+
current_chunk_size = [CHUNK_SIZE, len - offset].min
|
|
128
|
+
|
|
129
|
+
# Calculate extended range for Halo
|
|
130
|
+
# R indices start at 1, but pull_double_vector uses 0-based offset
|
|
131
|
+
pull_offset = [0, offset - halo].max
|
|
132
|
+
pull_end = [len, offset + current_chunk_size + halo].min
|
|
133
|
+
actual_pull_size = pull_end - pull_offset
|
|
134
|
+
|
|
135
|
+
# 3.1 Pull chunk with Halo
|
|
136
|
+
data = ::R.bridge.pull_double_vector(@r_interop, len, pull_offset, actual_pull_size)
|
|
137
|
+
|
|
138
|
+
# 3.2 Process in Ruby
|
|
139
|
+
# The block receives the data with halo.
|
|
140
|
+
# It's up to the block to handle the context,
|
|
141
|
+
# but the result should be the same size as data.
|
|
142
|
+
result_data_with_halo = block.call(data)
|
|
143
|
+
|
|
144
|
+
# 3.3 Extract the "inner" part (discard halo results)
|
|
145
|
+
# The offset of our chunk within the pulled data is (offset - pull_offset)
|
|
146
|
+
inner_start = offset - pull_offset
|
|
147
|
+
inner_result = result_data_with_halo[inner_start, current_chunk_size]
|
|
148
|
+
|
|
149
|
+
# 3.4 Push only the inner chunk back to R
|
|
150
|
+
::R.bridge.push_double_vector(inner_result, res_name, offset, len)
|
|
151
|
+
|
|
152
|
+
offset += current_chunk_size
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# 4. Return as R::Object (wrapped as Vector)
|
|
156
|
+
::R::Object.build(res_name)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def map(&block)
|
|
160
|
+
stitch(halo: 0) do |data|
|
|
161
|
+
data.map(&block)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def each(mode = :vec)
|
|
166
|
+
case mode
|
|
74
167
|
when :vec
|
|
75
|
-
|
|
76
|
-
# use the >> operator
|
|
77
|
-
(1..length >> 0).each do |i|
|
|
168
|
+
(1..length.unboxed_get(0)).each do |i|
|
|
78
169
|
yield self[i]
|
|
79
170
|
end
|
|
80
171
|
when :native
|
|
81
|
-
(0...length
|
|
82
|
-
yield
|
|
172
|
+
(0...length.unboxed_get(0)).each do |i|
|
|
173
|
+
yield unboxed_get(i)
|
|
83
174
|
end
|
|
84
175
|
else
|
|
85
|
-
raise
|
|
176
|
+
::Kernel.raise("Type #{mode.inspect} is unknown for method :each")
|
|
86
177
|
end
|
|
87
|
-
|
|
88
178
|
end
|
|
89
179
|
|
|
90
180
|
#--------------------------------------------------------------------------------------
|
|
@@ -94,15 +184,15 @@ module R
|
|
|
94
184
|
def each_with_index(result = :vec)
|
|
95
185
|
case result
|
|
96
186
|
when :vec
|
|
97
|
-
(1..length
|
|
187
|
+
(1..length.unboxed_get(0)).each do |i|
|
|
98
188
|
yield self[i], i
|
|
99
189
|
end
|
|
100
190
|
when :native
|
|
101
|
-
(0...length
|
|
102
|
-
yield
|
|
191
|
+
(0...length.unboxed_get(0)).each do |i|
|
|
192
|
+
yield unboxed_get(i), i
|
|
103
193
|
end
|
|
104
194
|
else
|
|
105
|
-
raise
|
|
195
|
+
::Kernel.raise("Type #{result} is unknown for method :each")
|
|
106
196
|
end
|
|
107
197
|
|
|
108
198
|
end
|
|
@@ -112,7 +202,33 @@ module R
|
|
|
112
202
|
#--------------------------------------------------------------------------------------
|
|
113
203
|
|
|
114
204
|
def <=>(other_vector)
|
|
115
|
-
|
|
205
|
+
::Kernel.raise(::NotImplementedError, "R::Vector#<=> is not implemented")
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
private
|
|
209
|
+
|
|
210
|
+
# Length via result protocol (scalar assignment envelope), not printed `[1] n` text.
|
|
211
|
+
def atomic_vector_length
|
|
212
|
+
var_name = ::R::Support.generate_var_name
|
|
213
|
+
env = ::R.bridge.eval_r_with_result("#{var_name} <- length(#{@r_interop})")
|
|
214
|
+
raise "Result protocol: no envelope for length(#{@r_interop})" unless env
|
|
215
|
+
case env[:type]
|
|
216
|
+
when :scalar_integer
|
|
217
|
+
env[:value].to_i
|
|
218
|
+
when :scalar_double
|
|
219
|
+
env[:value].to_i
|
|
220
|
+
else
|
|
221
|
+
raise "Result protocol: expected scalar length, got #{env[:type].inspect}"
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# R typeof() as string via result protocol.
|
|
226
|
+
def atomic_vector_typeof
|
|
227
|
+
var_name = ::R::Support.generate_var_name
|
|
228
|
+
env = ::R.bridge.eval_r_with_result("#{var_name} <- typeof(#{@r_interop})")
|
|
229
|
+
raise "Result protocol: no envelope for typeof(#{@r_interop})" unless env
|
|
230
|
+
raise "Result protocol: expected scalar_character for typeof, got #{env[:type]}" unless env[:type] == :scalar_character
|
|
231
|
+
env[:value].to_s
|
|
116
232
|
end
|
|
117
233
|
|
|
118
234
|
end
|
data/lib/galaaz.rb
CHANGED
|
File without changes
|
data/lib/galaaz_jruby.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# JVM arguments required for every JRuby process that loads Galaaz (Apache Arrow memory
|
|
4
|
+
# on Java 9+). Rake and Ruby launchers should use GalaazJRuby.shell_j_arg_string.
|
|
5
|
+
#
|
|
6
|
+
# Optional extra flags (e.g. -J-Xmx4g): set environment variable GALAAZ_JRUBY_OPTS
|
|
7
|
+
# (space-separated; passed through to the shell unquoted).
|
|
8
|
+
#
|
|
9
|
+
# Bash entrypoints (bin/run_rspec, etc.) source bin/galaaz_jruby_env.inc.sh — keep the
|
|
10
|
+
# -J list there identical to REQUIRED_JRUBY_J_ARGS below.
|
|
11
|
+
module GalaazJRuby
|
|
12
|
+
REQUIRED_JRUBY_J_ARGS = %w[
|
|
13
|
+
-J--add-opens=java.base/java.nio=ALL-UNNAMED
|
|
14
|
+
].freeze
|
|
15
|
+
|
|
16
|
+
OPTIONAL_ENV = 'GALAAZ_JRUBY_OPTS'
|
|
17
|
+
|
|
18
|
+
def self.shell_j_arg_string
|
|
19
|
+
extra = ENV[OPTIONAL_ENV].to_s.strip
|
|
20
|
+
[REQUIRED_JRUBY_J_ARGS.join(' '), extra].reject(&:empty?).join(' ')
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GknitDiagnostics
|
|
4
|
+
@internal_errors = []
|
|
5
|
+
|
|
6
|
+
INTERNAL_MESSAGE_PATTERNS = [
|
|
7
|
+
/undefined method .*R::NewBridgeAdapter/i,
|
|
8
|
+
/Result protocol:/i,
|
|
9
|
+
/invalid connection/i,
|
|
10
|
+
/galaaz_callback_call timeout/i,
|
|
11
|
+
/NewBridge::SessionClient::/i,
|
|
12
|
+
/Unsupported graphics device/i
|
|
13
|
+
].freeze
|
|
14
|
+
|
|
15
|
+
def self.reset!
|
|
16
|
+
@internal_errors = []
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.internal_errors
|
|
20
|
+
@internal_errors
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.internal_error?(error)
|
|
24
|
+
msg = error.message.to_s
|
|
25
|
+
INTERNAL_MESSAGE_PATTERNS.any? { |rx| rx.match?(msg) }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.record(chunk_label:, error:)
|
|
29
|
+
return unless internal_error?(error)
|
|
30
|
+
|
|
31
|
+
@internal_errors << {
|
|
32
|
+
chunk: chunk_label.to_s,
|
|
33
|
+
klass: error.class.to_s,
|
|
34
|
+
message: error.message.to_s
|
|
35
|
+
}
|
|
36
|
+
rescue StandardError
|
|
37
|
+
nil
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.print_report(io = $stderr)
|
|
41
|
+
return if @internal_errors.nil? || @internal_errors.empty?
|
|
42
|
+
|
|
43
|
+
io.puts
|
|
44
|
+
io.puts 'gknit internal errors detected:'
|
|
45
|
+
@internal_errors.each_with_index do |entry, idx|
|
|
46
|
+
io.puts " #{idx + 1}) chunk=#{entry[:chunk]} | #{entry[:klass]}: #{entry[:message]}"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
data/lib/gknit/draft.rb
CHANGED
|
@@ -27,26 +27,32 @@ module GKnit
|
|
|
27
27
|
#
|
|
28
28
|
#--------------------------------------------------------------------------------------
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
def self.template_path(gem, family, template)
|
|
31
|
+
full_filename = Dir.glob("gknit-templates*", base: "#{Gem.default_dir}/gems")
|
|
32
|
+
template_path = "#{Gem.default_dir}/gems/#{full_filename[0]}/#{family}/#{template}"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Register the template_path method as a callback
|
|
36
|
+
@template_path_cb = R::Support.register_callback(GKnit.singleton_method(:template_path))
|
|
37
|
+
|
|
38
|
+
R.bridge.eval_r(<<-R)
|
|
31
39
|
ruby_template = function(gem, family, template, type, ...) {
|
|
32
40
|
print(gem)
|
|
33
41
|
print(family)
|
|
34
42
|
print(template)
|
|
35
43
|
print(type)
|
|
36
|
-
|
|
44
|
+
|
|
45
|
+
# Use the new callback mechanism
|
|
46
|
+
cat('--G_CALLBACK--#{@template_path_cb}--', gem, '|', family, '|', template, '--\\n', sep='')
|
|
47
|
+
flush.console()
|
|
48
|
+
data_dir <- readLines('/dev/shm/galaaz_callback_fifo', n=1)
|
|
49
|
+
# The returned value from Ruby will be quoted, we might need to eval/parse it
|
|
50
|
+
data_dir <- eval(parse(text=data_dir))
|
|
51
|
+
|
|
37
52
|
print(data_dir)
|
|
38
53
|
invoke(type, list(template = "template.tex", pandoc_args = paste0("--data-dir=", data_dir), ...))
|
|
39
54
|
}
|
|
40
55
|
R
|
|
41
|
-
|
|
42
|
-
#--------------------------------------------------------------------------------------
|
|
43
|
-
#
|
|
44
|
-
#--------------------------------------------------------------------------------------
|
|
45
|
-
|
|
46
|
-
def self.template_path(gem, family, template)
|
|
47
|
-
full_filename = Dir.glob("gknit-templates*", base: "#{Gem.default_dir}/gems")
|
|
48
|
-
template_path = "#{Gem.default_dir}/gems/#{full_filename[0]}/#{family}/#{template}"
|
|
49
|
-
end
|
|
50
56
|
|
|
51
57
|
#--------------------------------------------------------------------------------------
|
|
52
58
|
#
|
|
@@ -63,9 +69,9 @@ module GKnit
|
|
|
63
69
|
# TODO: if package is a rubygem, then look there somehow
|
|
64
70
|
if (is_package)
|
|
65
71
|
template_path =
|
|
66
|
-
R.system__file("rmarkdown", "templates", template, package: package)
|
|
72
|
+
R.system__file("rmarkdown", "templates", template, package: package).unboxed_get(0)
|
|
67
73
|
raise "The template '#{template}' was not found in the package '#{package}'" if
|
|
68
|
-
!(R.nzchar(template_path)
|
|
74
|
+
!(R.nzchar(template_path).unboxed_get(0))
|
|
69
75
|
else
|
|
70
76
|
full_filename = Dir.glob("gknit-templates*", base: "#{Gem.default_dir}/gems")
|
|
71
77
|
template_path = "#{Gem.default_dir}/gems/#{full_filename[0]}/#{template}"
|
|
@@ -80,14 +86,14 @@ module GKnit
|
|
|
80
86
|
|
|
81
87
|
template_meta = R::Yaml::yaml__load(R.read_utf8(template_yaml))
|
|
82
88
|
raise "template.yaml must contain 'name' and 'description' fields" if
|
|
83
|
-
(template_meta.name.is__null || template_meta.description.is__null)
|
|
89
|
+
(template_meta.name.is__null || template_meta.description.is__null).unboxed_get(0)
|
|
84
90
|
puts "Creating template:"
|
|
85
|
-
puts "Template name: #{template_meta.name
|
|
86
|
-
puts "Description: #{template_meta.description
|
|
91
|
+
puts "Template name: #{template_meta.name.unboxed_get(0)}"
|
|
92
|
+
puts "Description: #{template_meta.description.unboxed_get(0)}"
|
|
87
93
|
|
|
88
94
|
if (create_dir == 'default')
|
|
89
95
|
# check if template asks for new directory
|
|
90
|
-
create_dir = template_meta.create_dir.isTRUE
|
|
96
|
+
create_dir = template_meta.create_dir.isTRUE.unboxed_get(0)
|
|
91
97
|
|
|
92
98
|
if (create_dir)
|
|
93
99
|
raise "The directory '#{file_basename}' already exists" if Dir.exist?(file_basename)
|
data/lib/gknit/include_engine.rb
CHANGED
|
@@ -36,13 +36,21 @@ class IncludeEngine < KnitrEngine
|
|
|
36
36
|
super
|
|
37
37
|
|
|
38
38
|
@engine = Proc.new do |options|
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
# Ensure include chunks always load file content into options['code'].
|
|
40
|
+
# This keeps include behavior working even if R-side wrappers are replaced.
|
|
41
|
+
begin
|
|
42
|
+
label = options['label'].unboxed_get(0).to_s
|
|
43
|
+
relative_opt = options['relative']
|
|
44
|
+
relative =
|
|
45
|
+
if relative_opt.respond_to?(:unboxed_get)
|
|
46
|
+
!!relative_opt.unboxed_get(0)
|
|
47
|
+
else
|
|
48
|
+
false
|
|
49
|
+
end
|
|
50
|
+
options.code = GalaazUtil.inline_file(label, relative)
|
|
51
|
+
rescue StandardError => e
|
|
52
|
+
options.code = "# Include failed: #{e.message}"
|
|
53
|
+
end
|
|
46
54
|
@base_engine.call(options)
|
|
47
55
|
end
|
|
48
56
|
|