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.
Files changed (391) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/LICENSE +0 -0
  4. data/README.md +3123 -882
  5. data/Rakefile +62 -41
  6. data/bin/galaaz-bootstrap +137 -0
  7. data/bin/galaaz-jruby +14 -0
  8. data/bin/galaaz_jruby_env.inc.sh +6 -0
  9. data/bin/gbookdown +64 -0
  10. data/bin/gknit +223 -6
  11. data/bin/gknit-draft +105 -0
  12. data/bin/gknit-draft.rb +28 -0
  13. data/bin/gknit_Rscript +127 -0
  14. data/bin/grun +27 -1
  15. data/bin/gstudio +49 -4
  16. data/bin/{gstudio.rb → gstudio_irb.rb} +0 -0
  17. data/bin/gstudio_pry.rb +7 -0
  18. data/bin/install-tinytex +6 -0
  19. data/bin/run_all_rspec +43 -0
  20. data/bin/run_example +14 -0
  21. data/bin/run_old_rspec +19 -0
  22. data/bin/run_rspec +23 -0
  23. data/bin/run_rspec_subset +38 -0
  24. data/bin/run_slow_rspec +19 -0
  25. data/blogs/R-on-Rails-Planning-Document.md +940 -0
  26. data/blogs/README.md +100 -0
  27. data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +38 -66
  28. data/blogs/galaaz_ggplot/galaaz_ggplot.log +754 -0
  29. data/blogs/galaaz_ggplot/galaaz_ggplot.md +364 -0
  30. data/blogs/galaaz_ggplot/galaaz_ggplot.tex +607 -0
  31. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
  32. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
  33. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
  34. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
  35. data/blogs/galaaz_ggplot/midwest.Rmd +3 -3
  36. data/blogs/galaaz_ggplot/midwest_external_png +0 -0
  37. data/blogs/gknit/gknit.Rmd +52 -55
  38. data/blogs/gknit/gknit.md +94 -94
  39. data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
  40. data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
  41. data/blogs/gknit/lst.rds +0 -0
  42. data/blogs/gknit/model.rb +1 -1
  43. data/blogs/gknit/stats.bib +0 -0
  44. data/blogs/manual/include_model_local_repro.Rmd +14 -0
  45. data/blogs/manual/include_model_local_repro.md +75 -0
  46. data/blogs/manual/lst.rds +0 -0
  47. data/blogs/manual/manual.Rmd +1582 -196
  48. data/blogs/manual/manual.log +1786 -0
  49. data/blogs/manual/manual.md +3107 -890
  50. data/blogs/manual/manual.tex +3018 -1086
  51. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  52. data/blogs/manual/manual_files/figure-html/diverging_bar.png +0 -0
  53. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  54. data/blogs/manual/model.rb +41 -0
  55. data/blogs/nse_dplyr/nse_dplyr.Rmd +277 -151
  56. data/blogs/nse_dplyr/nse_dplyr.log +928 -0
  57. data/blogs/nse_dplyr/nse_dplyr.md +457 -293
  58. data/blogs/oh_my/not_so.rb +0 -0
  59. data/blogs/oh_my/oh_my.Rmd +1234 -25
  60. data/blogs/oh_my/oh_my.log +804 -0
  61. data/blogs/oh_my/oh_my.md +1808 -228
  62. data/blogs/oh_my/oh_my.tex +821 -0
  63. data/blogs/oh_my/old.Rmd +15 -14
  64. data/blogs/ruby_plot/ruby_plot.Rmd +58 -82
  65. data/blogs/ruby_plot/ruby_plot.log +885 -0
  66. data/blogs/ruby_plot/ruby_plot.md +71 -103
  67. data/blogs/ruby_plot/ruby_plot.tex +940 -0
  68. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
  69. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
  70. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
  71. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
  72. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
  73. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
  74. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  75. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
  76. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
  77. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  78. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  79. data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
  80. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  81. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  82. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  83. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  84. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  85. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  86. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  87. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  88. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  89. data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  90. data/blogs/test/test.Rmd +14 -0
  91. data/examples/50Plots_MasterList/Images/midwest-scatterplot.PNG +0 -0
  92. data/examples/50Plots_MasterList/ScatterPlot.rb +0 -0
  93. data/examples/50Plots_MasterList/scatter_plot.rb +0 -0
  94. data/examples/Bibliography/master.bib +50 -0
  95. data/examples/Bibliography/stats.bib +72 -0
  96. data/examples/R/calc.R +0 -0
  97. data/examples/R/java_interop.R +0 -0
  98. data/examples/bioconductor_deseq2_airway/Documentation/DESeq2-airway-walkthrough.md +56 -0
  99. data/examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb +53 -0
  100. data/examples/bioconductor_deseq2_airway/bench_r_three_same_process.R +34 -0
  101. data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb +33 -0
  102. data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz_optimized.rb +34 -0
  103. data/examples/bioconductor_deseq2_airway/deseq2_airway_minimal.R +30 -0
  104. data/examples/bioconductor_deseq2_airway/deseq2_airway_pipeline_for_bench.R +36 -0
  105. data/examples/islr/all.rb +13 -0
  106. data/examples/islr/ch2.spec.rb +37 -7
  107. data/examples/islr/ch3.spec.rb +11 -2
  108. data/examples/islr/ch3_boston.rb +27 -0
  109. data/examples/islr/ch3_multiple_regression.rb +0 -0
  110. data/examples/islr/ch6.spec.rb +24 -1
  111. data/examples/islr/x_y_rnorm.jpg +0 -0
  112. data/examples/latex_templates/Test-acm_article/Makefile +16 -0
  113. data/examples/latex_templates/Test-acm_article/Test-acm_article.Rmd +65 -0
  114. data/examples/latex_templates/Test-acm_article/acm_proc_article-sp.cls +1670 -0
  115. data/examples/latex_templates/Test-acm_article/sensys-abstract.cls +703 -0
  116. data/examples/latex_templates/Test-acm_article/sigproc.bib +59 -0
  117. data/examples/latex_templates/Test-acs_article/Test-acs_article.Rmd +260 -0
  118. data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +11 -0
  119. data/examples/latex_templates/Test-acs_article/acs-my_output.bib +11 -0
  120. data/examples/latex_templates/Test-acs_article/acstest.bib +17 -0
  121. data/examples/latex_templates/Test-aea_article/AEA.cls +1414 -0
  122. data/{blogs/gknit/marshal.dump → examples/latex_templates/Test-aea_article/BibFile.bib} +0 -0
  123. data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +108 -0
  124. data/examples/latex_templates/Test-aea_article/aea.bst +1269 -0
  125. data/examples/latex_templates/Test-aea_article/multicol.sty +853 -0
  126. data/examples/latex_templates/Test-aea_article/references.bib +0 -0
  127. data/examples/latex_templates/Test-aea_article/setspace.sty +546 -0
  128. data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +256 -0
  129. data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +3397 -0
  130. data/examples/latex_templates/Test-ams_article/Test-ams_article.Rmd +215 -0
  131. data/examples/latex_templates/Test-ams_article/amstest.bib +436 -0
  132. data/examples/latex_templates/Test-asa_article/Test-asa_article.Rmd +153 -0
  133. data/examples/latex_templates/Test-asa_article/agsm.bst +1353 -0
  134. data/examples/latex_templates/Test-asa_article/bibliography.bib +233 -0
  135. data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +2409 -0
  136. data/examples/latex_templates/Test-ieee_article/IEEEtran.cls +6346 -0
  137. data/examples/latex_templates/Test-ieee_article/Test-ieee_article.Rmd +175 -0
  138. data/examples/latex_templates/Test-ieee_article/mybibfile.bib +20 -0
  139. data/examples/latex_templates/Test-rjournal_article/RJournal.sty +335 -0
  140. data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +18 -0
  141. data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +52 -0
  142. data/examples/latex_templates/Test-springer_article/Test-springer_article.Rmd +65 -0
  143. data/examples/latex_templates/Test-springer_article/bibliography.bib +26 -0
  144. data/examples/latex_templates/Test-springer_article/spbasic.bst +1658 -0
  145. data/examples/latex_templates/Test-springer_article/spmpsci.bst +1512 -0
  146. data/examples/latex_templates/Test-springer_article/spphys.bst +1443 -0
  147. data/examples/latex_templates/Test-springer_article/svglov3.clo +113 -0
  148. data/examples/latex_templates/Test-springer_article/svjour3.cls +1431 -0
  149. data/examples/misc/baseball.csv +0 -0
  150. data/examples/misc/ggplot.rb +3 -2
  151. data/examples/misc/moneyball.rb +0 -0
  152. data/examples/misc/subsetting.rb +0 -0
  153. data/examples/multithread_shards_to_r/shards_to_r.rb +67 -0
  154. data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.Rmd +73 -0
  155. data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +382 -0
  156. data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +164 -0
  157. data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +92 -0
  158. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +482 -0
  159. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +280 -0
  160. data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +386 -0
  161. data/examples/sthda_ggplot/README.md +0 -0
  162. data/examples/sthda_ggplot/RUN.md +41 -0
  163. data/examples/sthda_ggplot/all.rb +0 -0
  164. data/examples/sthda_ggplot/one_variable_continuous/density_gg.rb +0 -0
  165. data/examples/sthda_ggplot/one_variable_continuous/geom_area.rb +0 -0
  166. data/examples/sthda_ggplot/one_variable_continuous/geom_density.rb +2 -0
  167. data/examples/sthda_ggplot/one_variable_continuous/geom_dotplot.rb +0 -0
  168. data/examples/sthda_ggplot/one_variable_continuous/geom_freqpoly.rb +0 -0
  169. data/examples/sthda_ggplot/one_variable_continuous/geom_histogram.rb +0 -0
  170. data/examples/sthda_ggplot/one_variable_continuous/histogram_density.rb +0 -0
  171. data/examples/sthda_ggplot/one_variable_continuous/stat.rb +0 -0
  172. data/examples/sthda_ggplot/one_variable_discrete/bar.rb +0 -0
  173. data/examples/sthda_ggplot/qplots/box_violin_dot.rb +0 -0
  174. data/examples/sthda_ggplot/qplots/scatter_plots.rb +0 -0
  175. data/examples/sthda_ggplot/scatter_gg.rb +0 -0
  176. data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_bin2d.rb +0 -0
  177. data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_density2d.rb +0 -0
  178. data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_hex.rb +0 -0
  179. data/examples/sthda_ggplot/two_variables_cont_cont/geom_point.rb +0 -0
  180. data/examples/sthda_ggplot/two_variables_cont_cont/geom_smooth.rb +0 -0
  181. data/examples/sthda_ggplot/two_variables_cont_cont/misc.rb +0 -0
  182. data/examples/sthda_ggplot/two_variables_cont_function/geom_area.rb +4 -3
  183. data/examples/sthda_ggplot/two_variables_disc_cont/geom_bar.rb +0 -0
  184. data/examples/sthda_ggplot/two_variables_disc_cont/geom_boxplot.rb +0 -0
  185. data/examples/sthda_ggplot/two_variables_disc_cont/geom_dotplot.rb +0 -0
  186. data/examples/sthda_ggplot/two_variables_disc_cont/geom_jitter.rb +0 -0
  187. data/examples/sthda_ggplot/two_variables_disc_cont/geom_line.rb +0 -0
  188. data/examples/sthda_ggplot/two_variables_disc_cont/geom_violin.rb +0 -0
  189. data/examples/sthda_ggplot/two_variables_disc_disc/geom_jitter.rb +0 -0
  190. data/examples/sthda_ggplot/two_variables_error/geom_crossbar.rb +0 -0
  191. data/ext/new_bridge/Makefile +46 -0
  192. data/ext/new_bridge/galaaz_gatekeeper_phase0.cpp +12 -0
  193. data/ext/new_bridge/galaaz_gatekeeper_phase1.cpp +1639 -0
  194. data/lib/R_interface/galaaz_device.R +20 -0
  195. data/lib/R_interface/include_engine.R +109 -0
  196. data/lib/R_interface/new_bridge_adapter.rb +824 -0
  197. data/lib/R_interface/r.rb +177 -25
  198. data/lib/R_interface/r_arrow.rb +113 -0
  199. data/lib/R_interface/r_libs.R +4 -4
  200. data/lib/R_interface/r_methods.rb +13 -116
  201. data/lib/R_interface/r_module_s.rb +0 -0
  202. data/lib/R_interface/rbinary_operators.rb +20 -2
  203. data/lib/R_interface/rclosure.rb +5 -1
  204. data/lib/R_interface/rdata_frame.rb +34 -70
  205. data/lib/R_interface/rdevice.rb +125 -0
  206. data/lib/R_interface/rdevices.R +0 -0
  207. data/lib/R_interface/renvironment.rb +10 -4
  208. data/lib/R_interface/rexpression.rb +5 -1
  209. data/lib/R_interface/rindexed_object.rb +41 -13
  210. data/lib/R_interface/rlanguage.rb +20 -62
  211. data/lib/R_interface/rlist.rb +115 -25
  212. data/lib/R_interface/rlogical_operators.rb +0 -0
  213. data/lib/R_interface/rmatrix.rb +2 -11
  214. data/lib/R_interface/rmd_indexed_object.rb +5 -1
  215. data/lib/R_interface/robject.rb +348 -290
  216. data/lib/R_interface/rpkg.rb +1 -0
  217. data/lib/R_interface/rsupport.rb +610 -331
  218. data/lib/R_interface/rsupport_scope.rb +2 -1
  219. data/lib/R_interface/rsymbol.rb +50 -0
  220. data/lib/R_interface/ruby_callback.rb +2 -3
  221. data/lib/R_interface/ruby_extensions.rb +225 -175
  222. data/lib/R_interface/runary_operators.rb +0 -0
  223. data/lib/R_interface/rvector.rb +147 -31
  224. data/lib/galaaz.rb +0 -0
  225. data/lib/galaaz_jruby.rb +22 -0
  226. data/lib/gknit/diagnostics.rb +50 -0
  227. data/lib/gknit/draft.rb +111 -0
  228. data/lib/gknit/include_engine.rb +15 -7
  229. data/lib/gknit/knitr_engine.rb +223 -107
  230. data/lib/gknit/rb_engine.rb +3 -3
  231. data/lib/gknit/ruby_engine.rb +0 -0
  232. data/lib/gknit.rb +3 -0
  233. data/lib/new_bridge/bootstrap/windows_bootstrap.rb +285 -0
  234. data/lib/new_bridge/envelope.rb +51 -0
  235. data/lib/new_bridge/eval_result.rb +26 -0
  236. data/lib/new_bridge/framing.rb +39 -0
  237. data/lib/new_bridge/instance_pool_client.rb +38 -0
  238. data/lib/new_bridge/r_instance_manager.rb +404 -0
  239. data/lib/new_bridge/session_client.rb +530 -0
  240. data/lib/new_bridge/tcp_framed.rb +44 -0
  241. data/lib/new_bridge.rb +9 -0
  242. data/lib/util/exec_ruby.rb +95 -46
  243. data/lib/util/inline_file.rb +35 -30
  244. data/new_bridge_specs/benchmark_phase5_5_unboxing_spec.rb +96 -0
  245. data/new_bridge_specs/eval_r_async_spec.rb +113 -0
  246. data/new_bridge_specs/integration_phase5_1_concurrent_spec.rb +50 -0
  247. data/new_bridge_specs/integration_phase5_1_eval_spec.rb +16 -0
  248. data/new_bridge_specs/integration_phase5_1_r_api_spec.rb +25 -0
  249. data/new_bridge_specs/integration_phase5_1_smoke_spec.rb +31 -0
  250. data/new_bridge_specs/integration_phase5_2_dataframe_unboxing_spec.rb +19 -0
  251. data/new_bridge_specs/integration_phase5_2_handle_eval_unboxing_spec.rb +25 -0
  252. data/new_bridge_specs/integration_phase5_3_callback_args_spec.rb +28 -0
  253. data/new_bridge_specs/integration_phase5_3_callback_error_spec.rb +22 -0
  254. data/new_bridge_specs/integration_phase5_3_callback_timeout_spec.rb +28 -0
  255. data/new_bridge_specs/integration_phase5_3_callbacks_smoke_spec.rb +22 -0
  256. data/new_bridge_specs/integration_phase5_3_edge_cases_spec.rb +52 -0
  257. data/new_bridge_specs/integration_phase5_3_nested_spec.rb +30 -0
  258. data/new_bridge_specs/integration_phase5_4_concurrent_sessions_spec.rb +53 -0
  259. data/new_bridge_specs/integration_phase5_4_nested_session_callbacks_spec.rb +49 -0
  260. data/new_bridge_specs/integration_phase5_4_session_routing_spec.rb +38 -0
  261. data/new_bridge_specs/integration_phase5_5_stress_concurrency_spec.rb +52 -0
  262. data/new_bridge_specs/integration_phase5_5_unbox_walk_spec.rb +46 -0
  263. data/new_bridge_specs/phase0_protocol_spec.rb +96 -0
  264. data/new_bridge_specs/phase1_req_ret_spec.rb +66 -0
  265. data/new_bridge_specs/phase2_multi_instance_spec.rb +67 -0
  266. data/new_bridge_specs/phase3_callbacks_spec.rb +71 -0
  267. data/new_bridge_specs/phase4_2_hardening_spec.rb +252 -0
  268. data/new_bridge_specs/phase4_3_r_instance_manager_spec.rb +85 -0
  269. data/new_bridge_specs/phase4_nested_callbacks_spec.rb +123 -0
  270. data/r_requires/ggplot.rb +0 -0
  271. data/r_requires/knitr.rb +0 -0
  272. data/specs/all.rb +15 -11
  273. data/specs/arrow_from_ruby_batches_spec.rb +50 -0
  274. data/specs/arrow_semantics_spec.rb +64 -0
  275. data/specs/bridge_concurrent_spec.rb +46 -0
  276. data/specs/bridge_nested_spec.rb +25 -0
  277. data/specs/dataframe_semantics_spec.rb +122 -0
  278. data/specs/dataframe_single_index_logical_filter_spec.rb +21 -0
  279. data/specs/dispatch_probe_cache_spec.rb +38 -0
  280. data/specs/dispatch_probe_error_class_fallback_spec.rb +20 -0
  281. data/specs/dispatch_probe_fallback_spec.rb +18 -0
  282. data/specs/environment_semantics_spec.rb +89 -0
  283. data/specs/field_access_spec.rb +31 -0
  284. data/specs/figures/bg.jpeg +0 -0
  285. data/specs/figures/bg.png +0 -0
  286. data/specs/figures/bg.svg +168 -57
  287. data/specs/figures/dose_len.png +0 -0
  288. data/specs/figures/no_args.jpeg +0 -0
  289. data/specs/figures/no_args.png +0 -0
  290. data/specs/figures/no_args.svg +168 -57
  291. data/specs/figures/width_height.jpeg +0 -0
  292. data/specs/figures/width_height.png +0 -0
  293. data/specs/figures/width_height_units1.jpeg +0 -0
  294. data/specs/figures/width_height_units1.png +0 -0
  295. data/specs/figures/width_height_units2.jpeg +0 -0
  296. data/specs/figures/width_height_units2.png +0 -0
  297. data/specs/formula_semantics_spec.rb +81 -0
  298. data/specs/galaaz_util_exec_ruby_spec.rb +85 -0
  299. data/specs/galaaz_util_inline_file_spec.rb +54 -0
  300. data/specs/gknit_cli_option_permutation_spec.rb +24 -0
  301. data/specs/gknit_include_engine_spec.rb +72 -0
  302. data/specs/gknit_install_timeout_report_spec.rb +69 -0
  303. data/specs/gknit_internal_error_report_spec.rb +57 -0
  304. data/specs/gknit_vector_map_output_spec.rb +59 -0
  305. data/specs/globalenv_guardrail_spec.rb +52 -0
  306. data/specs/language_expression_semantics_spec.rb +145 -0
  307. data/specs/list_semantics_spec.rb +111 -0
  308. data/specs/new_bridge_bulk_dataframe_transfer_spec.rb +44 -0
  309. data/specs/new_bridge_bulk_vector_transfer_spec.rb +73 -0
  310. data/specs/new_bridge_callback_timeout_spec.rb +69 -0
  311. data/specs/new_bridge_eval_r_fallback_spec.rb +55 -0
  312. data/specs/nil_null_spec.rb +42 -0
  313. data/specs/object_build_phase2_spec.rb +53 -0
  314. data/specs/phase1_callback_bridge_spec.rb +84 -0
  315. data/specs/phase2_gknit_generic_rendering_guardrail_spec.rb +46 -0
  316. data/specs/phase2_gknit_no_raw_code_leakage_spec.rb +43 -0
  317. data/specs/phase3_gknit_generic_graphics_capture_spec.rb +71 -0
  318. data/specs/plot_device_semantics_spec.rb +28 -0
  319. data/specs/plot_snapshot_semantics_spec.rb +58 -0
  320. data/specs/protocol_result_spec.rb +236 -0
  321. data/specs/r_batch_fail_fast_spec.rb +47 -0
  322. data/specs/r_bridge_bootstrap_spec.rb +11 -0
  323. data/specs/r_devices.spec.rb +1 -1
  324. data/specs/r_eval.spec.rb +16 -18
  325. data/specs/r_function.spec.rb +1 -1
  326. data/specs/r_instance_manager_spec.rb +285 -0
  327. data/specs/r_list_apply.spec.rb +15 -15
  328. data/specs/r_matrix.spec.rb +0 -0
  329. data/specs/r_nse.spec.rb +5 -5
  330. data/specs/r_object_send_dispatch_spec.rb +13 -0
  331. data/specs/r_vector_comparator_spec.rb +8 -0
  332. data/specs/r_vector_creation.spec.rb +0 -0
  333. data/specs/r_vector_functions.spec.rb +0 -0
  334. data/specs/r_vector_object.spec.rb +0 -0
  335. data/specs/r_vector_operators.spec.rb +0 -0
  336. data/specs/r_vector_structured_scalar_reads_spec.rb +35 -0
  337. data/specs/r_vector_subsetting.spec.rb +0 -0
  338. data/specs/range_helper_spec.rb +21 -0
  339. data/specs/rsupport_scope_spec.rb +28 -0
  340. data/specs/rsupport_var_name_thread_safety_spec.rb +24 -0
  341. data/specs/scalar_character_spec.rb +44 -0
  342. data/specs/scoped_symbol_dsl_refinement_spec.rb +40 -0
  343. data/specs/session_env_bridge_spec.rb +25 -0
  344. data/specs/simplecov_bootstrap_spec.rb +10 -0
  345. data/specs/spec_helper.rb +10 -0
  346. data/specs/tmp.rb +41 -20
  347. data/specs/unboxing_recursion_regression_spec.rb +30 -0
  348. data/specs/unboxing_spec.rb +49 -0
  349. data/specs/verify_callbacks.rb +42 -0
  350. data/sty/galaaz.sty +0 -0
  351. data/version.rb +1 -1
  352. metadata +239 -71
  353. data/blogs/galaaz_ggplot/galaaz_ggplot.aux +0 -41
  354. data/blogs/galaaz_ggplot/galaaz_ggplot.html +0 -705
  355. data/blogs/galaaz_ggplot/galaaz_ggplot.out +0 -10
  356. data/blogs/galaaz_ggplot/galaaz_ggplot.pdf +0 -0
  357. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/midwest_rb.pdf +0 -0
  358. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/scatter_plot_rb.pdf +0 -0
  359. data/blogs/galaaz_ggplot/midwest.html +0 -188
  360. data/blogs/gknit/gknit.html +0 -2266
  361. data/blogs/gknit/gknit.pdf +0 -0
  362. data/blogs/gknit/gknit.tex +0 -1358
  363. data/blogs/manual/graph.rb +0 -29
  364. data/blogs/manual/manual.html +0 -2995
  365. data/blogs/manual/manual.pdf +0 -0
  366. data/blogs/manual/manual_files/figure-latex/diverging_bar.pdf +0 -0
  367. data/blogs/nse_dplyr/nse_dplyr.html +0 -960
  368. data/blogs/nse_dplyr/nse_dplyr.pdf +0 -0
  369. data/blogs/nse_dplyr/nse_dplyr.tex +0 -1373
  370. data/blogs/oh_my/oh_my.html +0 -680
  371. data/blogs/ruby_plot/ruby_plot.Rmd_external_figs +0 -662
  372. data/blogs/ruby_plot/ruby_plot.html +0 -729
  373. data/blogs/ruby_plot/ruby_plot.pdf +0 -0
  374. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.svg +0 -57
  375. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.svg +0 -106
  376. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.svg +0 -110
  377. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.svg +0 -174
  378. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.svg +0 -236
  379. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.svg +0 -296
  380. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.svg +0 -236
  381. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.svg +0 -218
  382. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.svg +0 -128
  383. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.svg +0 -150
  384. data/examples/paper/paper.rb +0 -36
  385. data/specs/r_dataframe.spec.rb +0 -379
  386. data/specs/r_environment.spec.rb +0 -140
  387. data/specs/r_formula.spec.rb +0 -232
  388. data/specs/r_language.spec.rb +0 -112
  389. data/specs/r_list.spec.rb +0 -293
  390. data/specs/r_plots.spec.rb +0 -72
  391. data/specs/ruby_expression.spec.rb +0 -315
data/blogs/oh_my/old.Rmd CHANGED
@@ -1,9 +1,10 @@
1
1
  ---
2
2
  title: "Extending R with classes, modules, procs, lambdas, oh my!"
3
+ subtitle: "Archived variant (Renjin-era narrative); see `oh_my.Rmd` and the Galaaz 2.0 manual for current stack"
3
4
  author:
4
5
  - "Rodrigo Botafogo"
5
6
  - "Daniel Mossé - University of Pittsburgh"
6
- tags: [Tech, Data Science, Ruby, R, GraalVM]
7
+ tags: [Archived, Tech, Data Science, Ruby, R, Renjin]
7
8
  date: "November 19th, 2018"
8
9
  output:
9
10
  html_document:
@@ -25,11 +26,11 @@ fontsize: 11pt
25
26
 
26
27
  # Introduction
27
28
 
28
- This paper introduces and compares Galaaz with R's S4. It is a shameless rip off of
29
+ This paper introduces and compares Galaaz with R's S4. It is **modeled closely** on
29
30
  ["A '(not so)' Short Introduction to S4"](https://cran.r-project.org/doc/contrib/Genolini-S4tutorialV0-5en.pdf) by Christophe Genolini and follows the same structure and examples presented there.
30
31
 
31
32
  Galaaz is a Ruby Gem (library) that allows very tight integration between Ruby and R.
32
- It's integration is much tigher and transparent from what one can get beetween RinRuby
33
+ Its integration is tighter and more transparent than what one can get between RinRuby
33
34
  or similar solutions in Python
34
35
  such as [PypeR](https://pypi.python.org/pypi/PypeR/1.1.0), [rpy2](http://rpy2.bitbucket.org/)
35
36
  and other similar solutions. Galaaz targets the Java Virtual Machine and it
@@ -84,7 +85,7 @@ type information is also not a "compile" time type, since R is not compiled. Th
84
85
  checked at runtime. The same checking can be done in Ruby and we will do it later in this
85
86
  document.
86
87
 
87
- In the example bellow, we create
88
+ In the example below, we create
88
89
  class Trajectories with two instance variables, 'times' and 'matrix'. We will not go over
89
90
  the details of instance variables in Ruby, but here we created those variables with the
90
91
  keyword 'attr_reader' and a column before the variables name:
@@ -101,7 +102,7 @@ end
101
102
 
102
103
 
103
104
  In order to create a new instance of object Trajectories we call method new on the class and
104
- we can store the result in a varible (not an instance variable) as bellow:
105
+ we can store the result in a variable (not an instance variable) as below:
105
106
 
106
107
  ```
107
108
  traj = Trajectories.new
@@ -125,7 +126,7 @@ puts traj.times
125
126
  Since there is no content stored in 'times' nor 'matrix', nil is returned. In order to add
126
127
  a value in the variables, we need to add a constructor the class Trajectories. In R, a
127
128
  constructor is build by default, in Ruby, this has to be created by adding a method called
128
- 'initialize'. In the example bellow, we will create the initializer that accepts two values,
129
+ 'initialize'. In the example below, we will create the initializer that accepts two values,
129
130
  a 'times' value and a 'matrix' value and they are used to initialize the value of the
130
131
  instance variables:
131
132
  EOT
@@ -154,7 +155,7 @@ i.e., R functions are all defined in Galaaz in the R namespace.
154
155
  Since Galaaz is Ruby and not R, some syntax adjustments are sometimes necessary. For instance,
155
156
  in R, a range is represented as '(1:4)', in Ruby, the same range is represented as '(1..4)'.
156
157
  When passing arguments to an R function in R one uses the '=' sign after the slot name; in R,
157
- one uses the ':' operator after parameter's name as we can see bellow:
158
+ one uses the ':' operator after parameter's name as we can see below:
158
159
  EOT
159
160
 
160
161
  ```
@@ -274,7 +275,7 @@ recommend its use, there are many cases in which default values are useful and m
274
275
  We have already seen default values in this document, with the default being 'nil'. This was
275
276
  necessary in order to be able to create our constructor and passing it the proper values.
276
277
 
277
- In the example bellow, a class TrajectoriesBis is created with default value 1 for times and a
278
+ In the example below, a class TrajectoriesBis is created with default value 1 for times and a
278
279
  matrix with no elements in matrix.
279
280
 
280
281
  ```{ruby}
@@ -377,7 +378,7 @@ Trajectories to add methods to it. In SS4, a method 'plot' is added to Trajecto
377
378
  point, Renjin and Galaaz do not yet have plotting capabilities, so we will have to skip this
378
379
  method and go directly to the implementation of the 'print' method.
379
380
 
380
- Bellow is the R code for method print:
381
+ Below is the R code for method print:
381
382
 
382
383
  ```
383
384
  > setMethod ("print","Trajectories",
@@ -469,7 +470,7 @@ features of Galaaz, some we have already seen, others will be described now:
469
470
  an R vector that holds a number, then @num.gz is a number that can be used normally with Ruby
470
471
  methods;
471
472
 
472
- * R functions and Ruby methods can be used freely in Galaaz. We show bellow two different ways
473
+ * R functions and Ruby methods can be used freely in Galaaz. We show below two different ways
473
474
  of getting the minimum of a number, either by calling R.min or by getting the minimum of an
474
475
  array, with the min method;
475
476
 
@@ -1191,7 +1192,7 @@ to this point was protected from any changes to those variables. If we need to
1191
1192
  to those variable, then setters are needed. In this case, the simple setter as shown above is
1192
1193
  not ideal, since it would allow changes that break the restriction that variable times has to
1193
1194
  have the same length as the number of columns of matrix. In order to do the verification we
1194
- need to implement a more sophisticated setter. In the example bellow, we add the 'times=' setter
1195
+ need to implement a more sophisticated setter. In the example below, we add the 'times=' setter
1195
1196
  that receives as input one argument. First we convert the given argument to an R object, then
1196
1197
  check to see that the length of times is the same as the number of columns and if everything is
1197
1198
  fine, then we set the value of instance variable times:
@@ -1282,7 +1283,7 @@ have already seen in many of the examples above. The example in SS4 presents a
1282
1283
  different output if its input is numeric, character has both. Let's write a class in Ruby that
1283
1284
  does the same for Numeric and String. In Ruby we do not define global functions, we always define
1284
1285
  methods inside classes or modules (as we will see later). Also, Ruby is not typed, so methods are
1285
- not called depending on their types as in SS4 examples. Bellow, method test will be called with
1286
+ not called depending on their types as in SS4 examples. Below, method test will be called with
1286
1287
  one parameter. At the time of calling we do not know the type of the argument, the method can
1287
1288
  then check is the received argument is a Numeric or a String and at this time, decide what should
1288
1289
  be printed.
@@ -1774,7 +1775,7 @@ As we can now see, trajCochin and cochin_internal have different content, while
1774
1775
  still has the same value in index 0, i.e. 15.0, trajCochin matrix has value 1 in index 1. This
1775
1776
  shows that Renjin when assigning to trajCochin.matrix[1] makes a copy of the original data.
1776
1777
 
1777
- Bellow, we use method 'get' which is a synonym of method 'as__mdarray' to again get the content
1778
+ Below, we use method 'get' which is a synonym of method 'as__mdarray' to again get the content
1778
1779
  of trajCochin.matrix. This variable has as first element the value 1, as set previously.
1779
1780
 
1780
1781
  ```
@@ -1942,7 +1943,7 @@ As you can see, 'ruby.array' is still the same Ruby object.
1942
1943
  Avatars maintain some properties of their original world. Although the concept of method
1943
1944
  chaning is foreign to R, chaining can be used with imported objects from Ruby. Method
1944
1945
  chaining occurs when the result of a applying a method on an object returns an object (usually
1945
- the same object) in which another method can be applied. In the example bellow, method '<<'
1946
+ the same object) in which another method can be applied. In the example below, method '<<'
1946
1947
  will be applied multiple times for ruby.array
1947
1948
  EOT
1948
1949
 
@@ -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, GraalVM]
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
@@ -31,59 +31,33 @@ general-purpose programming language. It was designed and developed in the mid-1
31
31
  "Matz" Matsumoto in Japan." It reached high popularity with the development of Ruby on Rails
32
32
  (RoR) by David Heinemeier Hansson. RoR is a web application framework first released
33
33
  around 2005. It makes extensive use of Ruby's metaprogramming features. With RoR,
34
- Ruby became very popular. According to [Ruby's Tiobe index](https://www.tiobe.com/tiobe-index/ruby/)
35
- it peeked in popularity around 2008, then declined until 2015 when it started picking up again.
36
- At the time of this writing (November 2018), the Tiobe index puts Ruby in 16th position as
37
- most popular language.
34
+ Ruby became very popular. According to [Ruby’s ranking in the TIOBE index](https://www.tiobe.com/tiobe-index/ruby/)
35
+ it **peaked** in popularity around 2008, then declined until 2015 when it started picking up again.
36
+ As of the original publication date (November 2018), TIOBE placed Ruby around 16th among languages.
38
37
 
39
- Python, a language similar to Ruby, ranks 4th in the index. Java, C and C++ take the
40
- first three positions. Ruby is often criticized for its focus on web applications.
38
+ Python, often grouped with Ruby as a high-level scripting language, ranked higher in that same snapshot.
39
+ Ruby is often criticized for its focus on web applications.
41
40
  But Ruby can do [much more](https://github.com/markets/awesome-ruby) than just web applications.
42
- Yet, for scientific computing, Ruby lags way behind Python and R. Python has
43
- Django framework for web, NumPy for numerical arrays, Pandas for data analysis.
41
+ Yet, for scientific computing, Ruby lags behind Python and R. Python combines web frameworks such as
42
+ Django with NumPy, pandas, SciPy, and **a very large ecosystem** of domain-specific packages.
44
43
  R is a free software environment for statistical computing and graphics with thousands
45
44
  of libraries for data analysis.
46
45
 
47
46
  Until recently, there was no real perspective for Ruby to bridge this gap.
48
47
  Implementing a complete scientific computing infrastructure would take too long.
49
- Enters [Oracle's GraalVM](https://www.graalvm.org/):
50
-
51
- > GraalVM is a universal virtual machine for running applications written in
52
- > JavaScript, Python 3, Ruby, R, JVM-based languages like Java, Scala, Kotlin,
53
- > and LLVM-based languages such as C and C++.
54
- >
55
- > GraalVM removes the isolation between programming languages and enables
56
- > interoperability in a shared runtime. It can run either standalone or in the
57
- > context of OpenJDK, Node.js, Oracle Database, or MySQL.
58
- >
59
- > GraalVM allows you to write polyglot applications with a seamless way to pass
60
- > values from one language to another. With GraalVM there is no copying or
61
- > marshaling necessary as it is with other polyglot systems. This lets you
62
- > achieve high performance when language boundaries are crossed. Most of the time
63
- > there is no additional cost for crossing a language boundary at all.
64
- >
65
- > Often developers have to make uncomfortable compromises that require them
66
- > to rewrite their software in other languages. For example:
67
- >
68
- > * That library is not available in my language. I need to rewrite it.
69
- > * That language would be the perfect fit for my problem, but we cannot
70
- > run it in our environment.
71
- > * That problem is already solved in my language, but the language is
72
- > too slow.
73
- >
74
- > With GraalVM we aim to allow developers to freely choose the right language for
75
- > the task at hand without making compromises.
76
-
77
- As stated above, GraalVM is a _universal_ virtual machine that allows Ruby and R (and other
78
- languages) to run on the same environment. GraalVM allows polyglot applications to
79
- _seamlessly_ interact with one another and pass values from one language to the other.
80
- Although a great idea, GraalVM still requires application writers to know several languages.
81
- To eliminate that requirement, we built Galaaz, a gem for Ruby, to tightly couple
82
- Ruby and R and allow those languages to interact in a way that the user will be unaware
83
- of such interaction. In other words, a Ruby programmer will be able to use all
84
- the capabilities of R without knowing the R syntax.
85
-
86
- Library wrapping is a usual way of bringing features from one language into another.
48
+
49
+ **Galaaz 2.0** couples **[JRuby](https://www.jruby.org/)** (Ruby on the JVM) with **GNU R**—the
50
+ same R distribution used for data science everywhere. A **bridge** evaluates R from Ruby and
51
+ exchanges data between the two processes so that, from Ruby, you call R functions and work
52
+ with R objects using familiar Ruby syntax. In other words, a Ruby programmer can use the
53
+ capabilities of R without memorizing all of R’s syntax for day-to-day tasks.
54
+
55
+ An **earlier line of work** used Oracle’s **GraalVM** with **TruffleRuby** and **FastR** so that
56
+ Ruby and R could share one JVM runtime. That stack is **no longer** what Galaaz targets;
57
+ today’s Galaaz is developed and tested with **JRuby + GNU R** (see the project manual for setup
58
+ and command-line tools).
59
+
60
+ Library wrapping is a common way to bring features from one language into another.
87
61
  To improve performance, Python often wraps more efficient C libraries. For the
88
62
  Python developer, the existence of such C libraries is hidden. The problem with
89
63
  library wrapping is that for any new library, there is the need to handcraft a new
@@ -94,7 +68,7 @@ in Ruby. Doing so, all thousands of R libraries are available immediately
94
68
  to Ruby developers without any new wrapping effort.
95
69
 
96
70
  To show the power of Galaaz, we show in this article how Ruby can use R's ggplot2
97
- library tranparantly bringing to Ruby the power of high quality scientific plotting.
71
+ library **transparently**, bringing to Ruby the power of high-quality scientific plotting.
98
72
  We also show that migrating from R to Ruby with Galaaz is a matter of small
99
73
  syntactic changes. By using Ruby, the R developer can use all of Ruby's powerful
100
74
  object-oriented features. Also, with Ruby, it becomes much easier to move code
@@ -110,14 +84,14 @@ ggplot themes that will work the same as the Ruby module. Yet, writing a new th
110
84
  requires specific knowledge on theme writing. Ruby modules are standard to the
111
85
  language and don't need special knowledge.
112
86
 
113
- [Here](https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021) we show a scatter plot in Ruby also with Galaaz.
87
+ [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.
114
88
 
115
89
  # gKnit
116
90
 
117
91
  _Knitr_ is an application that converts text written in rmarkdown to many
118
92
  different output formats. For instance, a writer can convert an rmarkdown document
119
- to HTML, $LaTex$, docx and many other formats. Rmarkdown documents can contain
120
- text and _code chunks_. Knitr formats code chunks in a grayed box in the output document.
93
+ to HTML, LaTeX, Word, and many other formats. R Markdown documents can contain
94
+ text and _code chunks_. knitr formats code chunks in a shaded box in the output document.
121
95
  It also executes the code chunks and formats the output in a white box. Every line of
122
96
  output from the execution code is preceded by '##'.
123
97
 
@@ -131,7 +105,7 @@ With _gKnit_ Ruby code chunks can share data.
131
105
  # Exploring the Dataset
132
106
 
133
107
  Let's start by exploring our selected dataset. ToothGrowth is an R dataset. A dataset
134
- is like a simple excel spreadsheet, in which each column has only one type of data.
108
+ is like a simple Excel spreadsheet, in which each column has only one type of data.
135
109
  For instance one column can have float, the other integer, and a third strings.
136
110
  This dataset analyzes the length of odontoblasts (cells responsible for tooth growth)
137
111
  in 60 guinea pigs, where each animal received one of three dose levels of Vitamin C
@@ -140,15 +114,15 @@ in 60 guinea pigs, where each animal received one of three dose levels of Vitami
140
114
 
141
115
  The ToothGrowth dataset contains three columns: 'len', 'supp' and 'dose'. Let's
142
116
  take a look at a few rows of this dataset. In Galaaz, R variables are accessed
143
- by using the corresponding Ruby symbol preceeded by the tilda ('~') function. Note in the
117
+ by using the corresponding Ruby symbol with the tilde (`~`) operator. Note in the
144
118
  following chunk that 'ToothGrowth' is the R variable and Ruby's 'tooth_growth' is
145
- assigned the value of '~:ToothGrowth'.
119
+ assigned the value of '~R[:ToothGrowth]'.
146
120
 
147
121
  ```{ruby head}
148
122
  # Read the R ToothGrowth variable and assign it to the
149
123
  # Ruby instance variable tooth_growth that will be
150
124
  # available to all Ruby chunks in this document.
151
- tooth_growth = ~:ToothGrowth
125
+ tooth_growth = ~R[:ToothGrowth]
152
126
  # print the first few elements of the dataset
153
127
  puts tooth_growth.head
154
128
  ```
@@ -166,7 +140,7 @@ puts tooth_growth.len.head
166
140
 
167
141
  The 'dose' column contains a numeric value with either, 0.5, 1 or 2, although the
168
142
  first 6 rows as seen above only contain the 0.5 values. Even though those are
169
- number, they are better interpreted as a [factor or cathegory](https://swcarpentry.github.io/r-novice-inflammation/12-supp-factors/). So, let's convert our 'dose' column from numeric to 'factor'.
143
+ number, they are better interpreted as a [factor or category](https://swcarpentry.github.io/r-novice-inflammation/12-supp-factors/). So, let's convert our 'dose' column from numeric to 'factor'.
170
144
  In R, the function 'as.factor' is used to convert data in a vector to factors. To use this
171
145
  function from Galaaz the dot ('.') in the function name is substituted by '__' (double underline).
172
146
  The function 'as.factor' becomes 'R.as__factor' or just 'as__factor' when chaining.
@@ -221,7 +195,7 @@ to form the final graphics.
221
195
  In order to make a plot, we use the 'ggplot' function to the dataset. In R, this would be
222
196
  written as ```ggplot(<dataset>, ...)```. Galaaz gives you the flexibility to use
223
197
  either ```R.ggplot(<dataset>, ...)``` or ```<dataset>.ggplot(...)```. In the graph
224
- specification bellow, we use the second notation that looks more like Ruby.
198
+ specification below, we use the second notation that looks more like Ruby.
225
199
  ggplot uses the ‘aes’ method to specify
226
200
  x and y axes; in this case, the 'dose' on the $x$ axis and the 'length' on
227
201
  the $y$ axis: 'E.aes(x: :dose, y: :len)'. To specify the type of plot add a geom to
@@ -254,16 +228,16 @@ the 'facet_grid' method is a [_formula_](https://thomasleeper.com/Rcourse/Tutori
254
228
 
255
229
  In Galaaz we give programmers the flexibility to use two different ways to write formulas.
256
230
  In the first way, we use Ruby expressions and the '.til' function. The formula 'x ~ y', becomes
257
- ':x.til :y'. More information on expressions can be found in [Galaaz Manual](https://www.rubydoc.info/gems/galaaz/).
231
+ 'R[:x].til :y'. More information on expressions can be found in [Galaaz Manual](https://www.rubydoc.info/gems/galaaz/).
258
232
 
259
233
 
260
234
  Another way of writing a formula is to use the 'formula' function with the actual formula as
261
235
  a string. The formula ```x ~ y``` in R can be written as ```R.formula("x ~ y")```. For more
262
236
  complex formulas, the use of the 'formula' function is preferred.
263
237
 
264
- The formula ```:all.til :supp``` indicates to the 'facet_grid' function that it needs to
238
+ The formula ```R[:all].til :supp``` indicates to the 'facet_grid' function that it needs to
265
239
  facet the plot based on the ```supp``` variable and split the plot vertically. Changing
266
- the formula to ```:supp.til :all``` would split the plot horizontally.
240
+ the formula to ```R[:supp].til :all``` would split the plot horizontally.
267
241
 
268
242
  ```{ruby facet_by_delivery, dev = "png", fig.width = 540, fig.height = 560, units = "px"}
269
243
 
@@ -271,8 +245,8 @@ base_tooth = tooth_growth.ggplot(E.aes(x: :dose, y: :len, group: :dose))
271
245
 
272
246
  bp = base_tooth + R.geom_boxplot +
273
247
  # Split in vertical direction
274
- R.facet_grid(:all.til :supp)
275
-
248
+ R.facet_grid(R[:all].til :supp)
249
+
276
250
  puts bp
277
251
  ```
278
252
 
@@ -407,7 +381,7 @@ a boxplot known as a _violin plot_ with jittered data.
407
381
 
408
382
  ```{ruby violin_with_jitter, dev = "png", fig.width = 540, fig.height = 560, units = "px"}
409
383
  violin = base_tooth + R.geom_violin(E.aes(fill: :dose)) +
410
- R.facet_grid(:all.til :supp) +
384
+ R.facet_grid(R[:all].til :supp) +
411
385
  R.geom_jitter(shape: 23, color: "cyan3", size: 1) +
412
386
  R.scale_fill_manual(values: R.c("cyan", "deepskyblue", "deepskyblue4"),
413
387
  breaks: R.c("2","1","0.5"))
@@ -550,7 +524,7 @@ Each animal received one of three dose levels of vitamin C.
550
524
  EOT
551
525
 
552
526
  bp = tooth_growth.ggplot(E.aes(x: :supp, y: :len, group: :supp)) +
553
- R.geom_boxplot(E.aes(fill: :supp)) + R.facet_grid(:all.til :dose) +
527
+ R.geom_boxplot(E.aes(fill: :supp)) + R.facet_grid(R[:all].til :dose) +
554
528
  R.scale_fill_manual(values: R.c("cyan", "deepskyblue4")) +
555
529
  R.labs(title: "Tooth Growth: Length by Dose",
556
530
  subtitle: "Faceted by dose",
@@ -571,17 +545,17 @@ developer, migration to Ruby is a matter of small syntactic changes with a very
571
545
  learning curve. As the R developer becomes more proficient in Ruby, he can start using
572
546
  'classes', 'modules', 'procs', 'lambdas'.
573
547
 
574
- Trying to bring to Ruby the power of R starting from scratch is an enourmous endeavour
548
+ Trying to bring to Ruby the power of R starting from scratch is an enormous endeavour
575
549
  and would probably never be accomplished. Today's data scientists would certainly
576
550
  stick with either Python or R. Now, both the Ruby and R communities can benefit
577
- from this marriage, provided by Galaaz on top of GraalVM and Truffle's
578
- polyglot environment. We presented the process to couple Ruby and R, but this
579
- process can also be done to couple Ruby and JavaScript or Ruby and Python.
580
- In a polyglot world a *uniglot* language might be extremely relevant.
551
+ from this marriage: **Galaaz 2.0** uses **standard GNU R** for statistics and graphics
552
+ and **JRuby** for application code, threading, and the JVM ecosystem. We presented
553
+ the process to couple Ruby and R; the coupling is implemented by the Galaaz bridge and
554
+ **gKnit** for literate documents, not by a single GraalVM polyglot runtime.
581
555
 
582
- From the perspective of performance, GraalVM and Truffle promises improvements that could
583
- reach over 10 times, both for [FastR](https://medium.com/graalvm/faster-r-with-fastr-4b8db0e0dceb)
584
- and for [TruffleRuby](https://rubykaigi.org/2018/presentations/eregontp.html).
556
+ For performance, expect **ordinary GNU R** behaviour for model fitting and plotting, while
557
+ **JRuby** gives **real parallel threads** on the Ruby side and access to Java libraries when
558
+ you need them.
585
559
 
586
560
  This article has shown how to improve a plot step-by-step. Starting from a very simple
587
561
  boxplot with all default configurations, we moved slowly to our final plot. The important
@@ -595,11 +569,11 @@ be of great help for any Rubyist trying to write articles, blogs or documentatio
595
569
 
596
570
  # Installing Galaaz
597
571
 
598
- ## Prerequisites
572
+ ## Prerequisites (Galaaz 2.0)
599
573
 
600
- * GraalVM (>= rc8): https://github.com/oracle/graal/releases
601
- * TruffleRuby
602
- * FastR
574
+ * **JRuby** — Ruby on the JVM ([jruby.org](https://www.jruby.org/))
575
+ * A **JDK** compatible with your JRuby version
576
+ * **GNU R** — `R` on your `PATH`, with compilers/tools available if packages must be built from source
603
577
 
604
578
  The following R packages will be automatically installed when necessary, but could be installed prior
605
579
  to using gKnit if desired:
@@ -608,14 +582,16 @@ to using gKnit if desired:
608
582
  * gridExtra
609
583
  * knitr
610
584
 
611
- Installation of R packages requires a development environment and can be time consuming. In Linux,
612
- the gnu compiler and tools should be enough. I am not sure what is needed on the Mac.
585
+ Installation of R packages requires a development environment and can be time consuming. On Linux,
586
+ the usual build tools (e.g. a C/C++ compiler) are typically enough. On macOS, Xcode command-line tools
587
+ are commonly required.
613
588
 
614
589
  ## Preparation
615
590
 
616
- * gem install galaaz
591
+ * Install the **galaaz** gem (from RubyGems when published, or `gem build` / `path:` from a checkout).
617
592
 
618
593
  ## Usage
619
594
 
620
- * gknit <filename>
621
- * In a scrip add: require 'galaaz'
595
+ * From the Galaaz repository (or your installed layout), render documents with **`bin/gknit`** (see the project manual for flags such as `--output_format all`).
596
+ * In Ruby code: `require 'galaaz'`
597
+ * For running scripts with the correct JRuby and JVM options, use **`bin/galaaz-jruby`** as described in the manual.