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
@@ -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
- # When indexing with '[' or '[[' an R object is returned. Sometimes we need to have
45
- # access to an umboxed Ruby element, for instance, in an numeric array, we might want
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
- def >>(index)
52
- raise IndexError.new("index #{index} out of array bounds: -#{index - 1}...#{index - 1}") if
53
- (index >= @r_interop.size)
54
- @r_interop[index]
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
- self >> 0
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 each(result = :vec)
117
+ def stitch(halo: 0, &block)
118
+ len = atomic_vector_length
72
119
 
73
- case result
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
- # length is a R::Vector, in order to extract its size as a Numeric we need to
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 >> 0).each do |i|
82
- yield self >> i
172
+ (0...length.unboxed_get(0)).each do |i|
173
+ yield unboxed_get(i)
83
174
  end
84
175
  else
85
- raise "Type #{result} is unknown for method :each"
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 >> 0).each do |i|
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 >> 0).each do |i|
102
- yield self >> i, i
191
+ (0...length.unboxed_get(0)).each do |i|
192
+ yield unboxed_get(i), i
103
193
  end
104
194
  else
105
- raise "Type #{result} is unknown for method :each"
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
- puts "comparison called"
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
@@ -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
+
@@ -0,0 +1,111 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ ##########################################################################################
4
+ # @author Rodrigo Botafogo
5
+ #
6
+ # Copyright © 2018 Rodrigo Botafogo. All Rights Reserved. Permission to use, copy, modify,
7
+ # and distribute this software and its documentation, without fee and without a signed
8
+ # licensing agreement, is hereby granted, provided that the above copyright notice, this
9
+ # paragraph and the following two paragraphs appear in all copies, modifications, and
10
+ # distributions.
11
+ #
12
+ # IN NO EVENT SHALL RODRIGO BOTAFOGO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
13
+ # INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
14
+ # THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RODRIGO BOTAFOGO HAS BEEN ADVISED OF THE
15
+ # POSSIBILITY OF SUCH DAMAGE.
16
+ #
17
+ # RODRIGO BOTAFOGO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
19
+ # SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
20
+ # RODRIGO BOTAFOGO HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
21
+ # OR MODIFICATIONS.
22
+ ##########################################################################################
23
+
24
+ module GKnit
25
+
26
+ #--------------------------------------------------------------------------------------
27
+ #
28
+ #--------------------------------------------------------------------------------------
29
+
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)
39
+ ruby_template = function(gem, family, template, type, ...) {
40
+ print(gem)
41
+ print(family)
42
+ print(template)
43
+ print(type)
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
+
52
+ print(data_dir)
53
+ invoke(type, list(template = "template.tex", pandoc_args = paste0("--data-dir=", data_dir), ...))
54
+ }
55
+ R
56
+
57
+ #--------------------------------------------------------------------------------------
58
+ #
59
+ #--------------------------------------------------------------------------------------
60
+
61
+ def self.draft(file:, template:, package: nil,
62
+ create_dir: 'default', is_package: true, edit: true)
63
+
64
+ # ignore the file extension if given. It should always be an .Rmd file
65
+ file_basename = File.basename(file, File.extname(file))
66
+ file = "#{file_basename}.Rmd"
67
+
68
+ # resolve package file
69
+ # TODO: if package is a rubygem, then look there somehow
70
+ if (is_package)
71
+ template_path =
72
+ R.system__file("rmarkdown", "templates", template, package: package).unboxed_get(0)
73
+ raise "The template '#{template}' was not found in the package '#{package}'" if
74
+ !(R.nzchar(template_path).unboxed_get(0))
75
+ else
76
+ full_filename = Dir.glob("gknit-templates*", base: "#{Gem.default_dir}/gems")
77
+ template_path = "#{Gem.default_dir}/gems/#{full_filename[0]}/#{template}"
78
+ puts template_path
79
+ # raise "this is not an R package"
80
+ end
81
+
82
+ # read the template.yaml and confirm it has the right fields
83
+ template_yaml = File.expand_path("template.yaml", template_path)
84
+ raise "No 'template.yaml' file found for template '#{template}" if
85
+ !File.file?(template_yaml)
86
+
87
+ template_meta = R::Yaml::yaml__load(R.read_utf8(template_yaml))
88
+ raise "template.yaml must contain 'name' and 'description' fields" if
89
+ (template_meta.name.is__null || template_meta.description.is__null).unboxed_get(0)
90
+ puts "Creating template:"
91
+ puts "Template name: #{template_meta.name.unboxed_get(0)}"
92
+ puts "Description: #{template_meta.description.unboxed_get(0)}"
93
+
94
+ if (create_dir == 'default')
95
+ # check if template asks for new directory
96
+ create_dir = template_meta.create_dir.isTRUE.unboxed_get(0)
97
+
98
+ if (create_dir)
99
+ raise "The directory '#{file_basename}' already exists" if Dir.exist?(file_basename)
100
+ end
101
+
102
+ end
103
+
104
+ raise "File #{file} already exists" if File.file?("#{file_basename}/#{file}")
105
+ FileUtils.cp_r("#{template_path}/skeleton", "#{file_basename}")
106
+ # FileUtils.cp("#{template_path}/resources/template.tex", "#{file_basename}")
107
+ File.rename("#{file_basename}/skeleton.Rmd", "#{file_basename}/#{file}")
108
+ end
109
+
110
+ end
111
+
@@ -36,13 +36,21 @@ class IncludeEngine < KnitrEngine
36
36
  super
37
37
 
38
38
  @engine = Proc.new do |options|
39
-
40
- # check if require should be relative or not
41
- req = (options[['relative']].is__null | options[['relative']].isTRUE) >> 0
42
-
43
- # load the content of the file in options.code
44
- options.code = GalaazUtil.inline_file(options.label >> 0, req)
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