galaaz 2.1.8 → 2.1.9

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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/Rakefile +20 -2
  4. data/bin/check_gemfile_lock_version +46 -0
  5. data/bin/release_bump +26 -0
  6. data/blogs/README.md +4 -0
  7. data/blogs/galaaz_2_0/galaaz_2_0.Rmd +385 -0
  8. data/blogs/galaaz_2_0/galaaz_2_0.md +409 -0
  9. data/blogs/galaaz_2_0/galaaz_2_0.tex +756 -0
  10. data/blogs/galaaz_2_0/images/galaaz-header.png +0 -0
  11. data/blogs/galaaz_2_0/images/galaaz-lockup-stacked.png +0 -0
  12. data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +14 -1
  13. data/blogs/galaaz_ggplot/galaaz_ggplot.md +123 -103
  14. data/blogs/galaaz_ggplot/galaaz_ggplot.tex +60 -23
  15. data/blogs/galaaz_ggplot/images/galaaz-lockup-stacked.png +0 -0
  16. data/blogs/gknit/gknit.Rmd +16 -1
  17. data/blogs/gknit/gknit.md +13 -1
  18. data/blogs/gknit/gknit.tex +64 -23
  19. data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
  20. data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
  21. data/blogs/gknit/gknit_files/figure-latex/bubble-1.png +0 -0
  22. data/blogs/gknit/images/galaaz-lockup-stacked.png +0 -0
  23. data/blogs/manual/images/galaaz-lockup-stacked.png +0 -0
  24. data/blogs/manual/manual.Rmd +32 -11
  25. data/blogs/manual/manual.md +30 -23
  26. data/blogs/manual/manual.tex +88 -66
  27. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  28. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  29. data/blogs/nse_dplyr/images/galaaz-lockup-stacked.png +0 -0
  30. data/blogs/nse_dplyr/nse_dplyr.Rmd +14 -1
  31. data/blogs/nse_dplyr/nse_dplyr.md +697 -649
  32. data/blogs/nse_dplyr/nse_dplyr.tex +61 -24
  33. data/blogs/oh_my/images/galaaz-lockup-stacked.png +0 -0
  34. data/blogs/oh_my/oh_my.Rmd +14 -1
  35. data/blogs/oh_my/oh_my.md +36 -26
  36. data/blogs/oh_my/oh_my.tex +95 -58
  37. data/blogs/r_on_rails_ledger/images/00_portfolio_page.png +0 -0
  38. data/blogs/r_on_rails_ledger/images/01_results_panel.png +0 -0
  39. data/blogs/r_on_rails_ledger/images/02_density_tail_risk.png +0 -0
  40. data/blogs/r_on_rails_ledger/images/03_mc_cone.png +0 -0
  41. data/blogs/r_on_rails_ledger/images/04_rolling_var.png +0 -0
  42. data/blogs/r_on_rails_ledger/images/galaaz-lockup-stacked.png +0 -0
  43. data/blogs/r_on_rails_ledger/r_on_rails_ledger.Rmd +354 -0
  44. data/blogs/r_on_rails_ledger/r_on_rails_ledger.md +365 -0
  45. data/blogs/r_on_rails_ledger/r_on_rails_ledger.tex +670 -0
  46. data/blogs/ruby_plot/images/galaaz-lockup-stacked.png +0 -0
  47. data/blogs/ruby_plot/ruby_plot.Rmd +14 -1
  48. data/blogs/ruby_plot/ruby_plot.md +11 -1
  49. data/blogs/ruby_plot/ruby_plot.tex +60 -23
  50. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  51. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  52. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  53. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  54. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  55. data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  56. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  57. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  58. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  59. data/lib/galaaz/cli.rb +47 -3
  60. data/logos/icon-font/README.md +27 -0
  61. data/logos/icon-font/build_font.py +130 -0
  62. data/logos/icon-font/galaaz-mark.svg +34 -0
  63. data/script/omarchy/README.md +8 -1
  64. data/script/omarchy/fonts/galaaz.ttf +0 -0
  65. data/script/omarchy/install-galaaz.sh +8 -1
  66. data/script/omarchy/omarchy-menu.jsonc +21 -9
  67. data/sty/galaaz-header.png +0 -0
  68. data/sty/galaaz-headers-from-p3.tex +4 -0
  69. data/sty/galaaz.sty +54 -23
  70. data/version.rb +1 -1
  71. metadata +30 -9
  72. data/blogs/galaaz_ggplot/galaaz_ggplot.log +0 -745
  73. data/blogs/gknit/gknit_files/gknit_files/figure-latex/bubble-1.png +0 -0
  74. data/blogs/manual/manual.log +0 -1530
  75. data/blogs/manual/manual_files/manual_files/figure-latex/bubble-1.png +0 -0
  76. data/blogs/nse_dplyr/nse_dplyr.log +0 -824
  77. data/blogs/oh_my/oh_my.log +0 -974
  78. data/blogs/ruby_plot/ruby_plot.log +0 -887
@@ -10,11 +10,16 @@ output:
10
10
  self_contained: true
11
11
  keep_md: true
12
12
  toc: true
13
+ toc_float: true
13
14
  toc_depth: 3
14
15
  number_sections: true
16
+ includes:
17
+ before_body: _logo_before_body.html
15
18
  pdf_document:
16
19
  includes:
17
- in_header: "../../sty/galaaz.sty"
20
+ in_header:
21
+ - "../../sty/galaaz.sty"
22
+ - "../../sty/galaaz-headers-from-p3.tex"
18
23
  keep_tex: yes
19
24
  number_sections: yes
20
25
  toc: true
@@ -34,6 +39,11 @@ R.options(crayon__enabled: false, width: 70)
34
39
  R.install_and_loads('kableExtra')
35
40
  ```
36
41
 
42
+ ```{r brand_logo, echo=FALSE, fig.align='center', out.width='45%', eval=knitr::is_latex_output()}
43
+ # PDF only — HTML uses _logo_before_body.html (above the TOC).
44
+ knitr::include_graphics("images/galaaz-lockup-stacked.png")
45
+ ```
46
+
37
47
  # Introduction
38
48
 
39
49
  Galaaz is a system for tightly coupling Ruby and R. Ruby is a powerful language, with a large
@@ -208,7 +218,9 @@ df_gk <- data.frame(
208
218
  bin_tbl(df_gk)
209
219
  ```
210
220
 
211
- **`gknit` CLI** (see `gknit -h`): `--output_format`, `--output_file`, `--output_dir`, `--bridge_timeout_sec`, `--callback_timeout_ms`. If `--output_format` is omitted, the **first** YAML `output:` target wins.
221
+ **`gknit` CLI** (see `gknit -h`): `--output_format`, `--output_file`,
222
+ `--output_dir`, `--bridge_timeout_sec`, `--callback_timeout_ms`.
223
+ If `--output_format` is omitted, the **first** YAML `output:` target wins.
212
224
 
213
225
  Prefer **`galaaz-jruby`** for **`gknit-draft`** workflows until that wrapper matches the **`gknit`** stack.
214
226
 
@@ -295,7 +307,8 @@ A **table of all `bin/` scripts** (bootstrap, Ruby launcher, gstudio, gknit, tes
295
307
 
296
308
  1. Install **bundler** if needed, then run **`bundle install`** with your chosen Ruby
297
309
  (`jruby -S bundle install` or CRuby `bundle install`) in the repository root.
298
- 2. Build the bridge native code: **`make -C ext/new_bridge all`** (or **`rake compile_gatekeeper`**).
310
+ 2. Build the bridge native code: **`make -C ext/new_bridge all`**
311
+ (or **`rake compile_gatekeeper`**).
299
312
  3. Run scripts with **`bin/galaaz-ruby`** (uses `ruby` on `PATH`; set **`GALAAZ_RUBY=jruby`** or
300
313
  **`GALAAZ_RUBY=ruby`** to force an engine). Spec runners: **`bin/run_rspec`** /
301
314
  **`bin/run_all_rspec`** (same `GALAAZ_RUBY` rule). **`bin/galaaz-jruby`** remains a thin
@@ -422,8 +435,9 @@ For R work that can take a long time **on the bridge**, the bridge can avoid a R
422
435
  **`R.<rname>`**. Optional keyword **`timeout:`** applies a Ruby-side wait limit (completion receives
423
436
  **`NewBridge::SessionClient::TimeoutError`** if R is too slow).
424
437
 
425
- **Important:** **`R.foo(...) { |x| }`** is already used for dplyr-style scopes (`R::Support.new_scope`),
426
- so async R calls must use **`R::Async`** or **`R.eval_r_async`**, not a bare **`R.foo` with a block.**
438
+ **Important:** **`R.foo(...) { |x| }`** is already used for dplyr-style
439
+ scopes (`R::Support.new_scope`), so async R calls must use **`R::Async`**
440
+ or **`R.eval_r_async`**, not a bare **`R.foo` with a block.**
427
441
 
428
442
  `NewBridge::EvalResult` exposes **`#ok?`**, **`#value`**, and **`#error`**. The completion block runs on a
429
443
  **background thread** (not the bridge reader thread).
@@ -1473,7 +1487,12 @@ the first with a message explaining what went wrong and the second with the full
1473
1487
  of the error.
1474
1488
 
1475
1489
  ```{ruby r_exception}
1476
- vec = R.c(1, hello, 5)
1490
+ begin
1491
+ vec = R.c(1, hello, 5)
1492
+ rescue => e
1493
+ puts e.class.to_s
1494
+ e.message.to_s.scan(/.{1,68}/).each { |line| puts line }
1495
+ end
1477
1496
  ```
1478
1497
 
1479
1498
  Here is a vector with logical values
@@ -2211,11 +2230,13 @@ else
2211
2230
  end
2212
2231
  ```
2213
2232
 
2214
- **What to notice:** (1) Ruby only sees **`Hash`** rows and Ruby **`Thread`** objects; (2) a single
2215
- **`from_ruby_batches`** call creates the Arrow table in R; (3) **`dplyr___group_by`** /
2216
- **`dplyr___summarise`** / **`dplyr___collect`** mirror **`dplyr::group_by`** /
2217
- **`dplyr::summarise`** / **`dplyr::collect`** on an Arrow-backed table. For a lighter test, see
2218
- **`specs/arrow_from_ruby_batches_spec.rb`**; for the full-size benchmark, run
2233
+ **What to notice:** (1) Ruby only sees **`Hash`** rows and Ruby **`Thread`** objects;
2234
+ (2) a single **`from_ruby_batches`** call creates the Arrow table in R;
2235
+ (3) **`dplyr___group_by`** / **`dplyr___summarise`** / **`dplyr___collect`**
2236
+ mirror **`dplyr::group_by`** / **`dplyr::summarise`** / **`dplyr::collect`**
2237
+ on an Arrow-backed table. For a lighter test, see
2238
+ **`specs/arrow_from_ruby_batches_spec.rb`**;
2239
+ for the full-size benchmark, run
2219
2240
  **`bin/run_slow_rspec slow-specs/arrow_large_pipeline_spec.rb`**.
2220
2241
 
2221
2242
  # Bioconductor and DESeq2
@@ -10,11 +10,16 @@ output:
10
10
  self_contained: true
11
11
  keep_md: true
12
12
  toc: true
13
+ toc_float: true
13
14
  toc_depth: 3
14
15
  number_sections: true
16
+ includes:
17
+ before_body: _logo_before_body.html
15
18
  pdf_document:
16
19
  includes:
17
- in_header: "../../sty/galaaz.sty"
20
+ in_header:
21
+ - "../../sty/galaaz.sty"
22
+ - "../../sty/galaaz-headers-from-p3.tex"
18
23
  keep_tex: yes
19
24
  number_sections: yes
20
25
  toc: true
@@ -26,6 +31,8 @@ fontsize: 11pt
26
31
 
27
32
 
28
33
 
34
+
35
+
29
36
  # Introduction
30
37
 
31
38
  Galaaz is a system for tightly coupling Ruby and R. Ruby is a powerful language, with a large
@@ -226,7 +233,9 @@ bin/galaaz-jruby -S rspec
226
233
  </tbody>
227
234
  </table>
228
235
 
229
- **`gknit` CLI** (see `gknit -h`): `--output_format`, `--output_file`, `--output_dir`, `--bridge_timeout_sec`, `--callback_timeout_ms`. If `--output_format` is omitted, the **first** YAML `output:` target wins.
236
+ **`gknit` CLI** (see `gknit -h`): `--output_format`, `--output_file`,
237
+ `--output_dir`, `--bridge_timeout_sec`, `--callback_timeout_ms`.
238
+ If `--output_format` is omitted, the **first** YAML `output:` target wins.
230
239
 
231
240
  Prefer **`galaaz-jruby`** for **`gknit-draft`** workflows until that wrapper matches the **`gknit`** stack.
232
241
 
@@ -341,7 +350,8 @@ A **table of all `bin/` scripts** (bootstrap, Ruby launcher, gstudio, gknit, tes
341
350
 
342
351
  1. Install **bundler** if needed, then run **`bundle install`** with your chosen Ruby
343
352
  (`jruby -S bundle install` or CRuby `bundle install`) in the repository root.
344
- 2. Build the bridge native code: **`make -C ext/new_bridge all`** (or **`rake compile_gatekeeper`**).
353
+ 2. Build the bridge native code: **`make -C ext/new_bridge all`**
354
+ (or **`rake compile_gatekeeper`**).
345
355
  3. Run scripts with **`bin/galaaz-ruby`** (uses `ruby` on `PATH`; set **`GALAAZ_RUBY=jruby`** or
346
356
  **`GALAAZ_RUBY=ruby`** to force an engine). Spec runners: **`bin/run_rspec`** /
347
357
  **`bin/run_all_rspec`** (same `GALAAZ_RUBY` rule). **`bin/galaaz-jruby`** remains a thin
@@ -494,8 +504,9 @@ For R work that can take a long time **on the bridge**, the bridge can avoid a R
494
504
  **`R.<rname>`**. Optional keyword **`timeout:`** applies a Ruby-side wait limit (completion receives
495
505
  **`NewBridge::SessionClient::TimeoutError`** if R is too slow).
496
506
 
497
- **Important:** **`R.foo(...) { |x| }`** is already used for dplyr-style scopes (`R::Support.new_scope`),
498
- so async R calls must use **`R::Async`** or **`R.eval_r_async`**, not a bare **`R.foo` with a block.**
507
+ **Important:** **`R.foo(...) { |x| }`** is already used for dplyr-style
508
+ scopes (`R::Support.new_scope`), so async R calls must use **`R::Async`**
509
+ or **`R.eval_r_async`**, not a bare **`R.foo` with a block.**
499
510
 
500
511
  `NewBridge::EvalResult` exposes **`#ok?`**, **`#value`**, and **`#error`**. The completion block runs on a
501
512
  **background thread** (not the bridge reader thread).
@@ -2859,25 +2870,19 @@ of the error.
2859
2870
 
2860
2871
 
2861
2872
  ``` ruby
2862
- vec = R.c(1, hello, 5)
2873
+ begin
2874
+ vec = R.c(1, hello, 5)
2875
+ rescue => e
2876
+ puts e.class.to_s
2877
+ e.message.to_s.scan(/.{1,68}/).each { |line| puts line }
2878
+ end
2863
2879
  ```
2864
2880
 
2865
2881
  ```
2882
+ ## NameError
2866
2883
  ## undefined local variable or method 'hello' for an instance of RC
2867
2884
  ```
2868
2885
 
2869
- ```
2870
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:170:in 'exec_ruby'
2871
- ## org/jruby/RubyKernel.java:1459:in 'eval'
2872
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:169:in 'exec_ruby'
2873
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:777:in 'block in initialize'
2874
- ## org/jruby/RubyBasicObject.java:2713:in 'instance_eval'
2875
- ## org/jruby/RubyBasicObject.java:2741:in 'instance_eval'
2876
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:748:in 'block in initialize'
2877
- ## /home/rbotafogo/desenv_linux/galaaz/lib/R_interface/new_bridge_adapter.rb:371:in 'block in register_callback_proc_stub'
2878
- ## /home/rbotafogo/desenv_linux/galaaz/lib/new_bridge/session_client.rb:458:in 'block in handle_call'
2879
- ```
2880
-
2881
2886
  Here is a vector with logical values
2882
2887
 
2883
2888
 
@@ -4302,11 +4307,13 @@ end
4302
4307
  ## Sum of group counts n (should equal 2000): 2000
4303
4308
  ```
4304
4309
 
4305
- **What to notice:** (1) Ruby only sees **`Hash`** rows and Ruby **`Thread`** objects; (2) a single
4306
- **`from_ruby_batches`** call creates the Arrow table in R; (3) **`dplyr___group_by`** /
4307
- **`dplyr___summarise`** / **`dplyr___collect`** mirror **`dplyr::group_by`** /
4308
- **`dplyr::summarise`** / **`dplyr::collect`** on an Arrow-backed table. For a lighter test, see
4309
- **`specs/arrow_from_ruby_batches_spec.rb`**; for the full-size benchmark, run
4310
+ **What to notice:** (1) Ruby only sees **`Hash`** rows and Ruby **`Thread`** objects;
4311
+ (2) a single **`from_ruby_batches`** call creates the Arrow table in R;
4312
+ (3) **`dplyr___group_by`** / **`dplyr___summarise`** / **`dplyr___collect`**
4313
+ mirror **`dplyr::group_by`** / **`dplyr::summarise`** / **`dplyr::collect`**
4314
+ on an Arrow-backed table. For a lighter test, see
4315
+ **`specs/arrow_from_ruby_batches_spec.rb`**;
4316
+ for the full-size benchmark, run
4310
4317
  **`bin/run_slow_rspec slow-specs/arrow_large_pipeline_spec.rb`**.
4311
4318
 
4312
4319
  # Bioconductor and DESeq2
@@ -145,7 +145,7 @@
145
145
  \usepackage[utf8]{inputenc}
146
146
 
147
147
  \usepackage{geometry}
148
- \geometry{a4paper, top=1in}
148
+ \geometry{a4paper, top=1.05in, headheight=30pt, headsep=14pt}
149
149
 
150
150
  % needed for kableExtra
151
151
  \usepackage{longtable}
@@ -166,29 +166,60 @@
166
166
  \usepackage{graphicx}
167
167
 
168
168
  \usepackage{fancyhdr}
169
- % set the header and foot style
170
- % style 'fancy' adds the section name on the header
171
- % and the page number on the footer
169
+ % Header: small Galaaz mark (left); page number + section title (right),
170
+ % matching classic LaTeX style: "4 AN EXTENSION TO THE EXAMPLE"
171
+ % (upright page number, uppercase italic section name).
172
+ % Logo paths cover repo blogs (../../sty/), installed ~/sty/, and local images/.
173
+ % Blogs may delay headers with \renewcommand{\galaazheaderfrompage}{3} after this sty
174
+ % (e.g. skip title/TOC and a logo splash page).
175
+ \newcommand{\galaazheaderfrompage}{1}
176
+ \newcommand{\galaazheaderlogo}{%
177
+ \raisebox{-0.12\height}{%
178
+ \IfFileExists{../../sty/galaaz-header.png}{%
179
+ \includegraphics[height=0.32in]{../../sty/galaaz-header.png}%
180
+ }{%
181
+ \IfFileExists{galaaz-header.png}{%
182
+ \includegraphics[height=0.32in]{galaaz-header.png}%
183
+ }{%
184
+ \IfFileExists{images/galaaz-header.png}{%
185
+ \includegraphics[height=0.32in]{images/galaaz-header.png}%
186
+ }{}%
187
+ }%
188
+ }%
189
+ }%
190
+ }
191
+ % Section title only in marks (no \thesection); page number is separate.
192
+ \renewcommand{\sectionmark}[1]{\markboth{#1}{}}
193
+ \renewcommand{\subsectionmark}[1]{}% keep the current section in the header
194
+ \newcommand{\galaazmaybeheaderlogo}{%
195
+ \ifnum\value{page}<\galaazheaderfrompage\relax\else\galaazheaderlogo\fi}
196
+ \newcommand{\galaazmayberighthead}{%
197
+ \ifnum\value{page}<\galaazheaderfrompage\relax
198
+ \else
199
+ \textup{\thepage}\hspace{1em}\textit{\MakeUppercase{\leftmark}}%
200
+ \fi
201
+ }
172
202
  \pagestyle{fancy}
173
-
174
- % style 'fancyhf' leaves header and footer empty
175
- %\fancyhf{}
176
-
177
- % sets the left head element to \rightmark, which contains the
178
- % current section (\leftmark is the current chapter)
179
- %\fancyhead[L]{\rightmark} .
180
-
181
- % sets the right head element to the page number.
182
- % \fancyhead[R]{\thepage}
183
-
184
- % lets the head rule disappear.
185
- % \renewcommand{\headrulewidth}{0pt}
186
- % Possible selectors for the optional argument of \fancyhead/\fancyfoot
187
- % are L (left), C (center) or R (right) for the position of the element
188
- % and E (even) or O (odd) to distinguish even and odd pages. If you omit
189
- % E/O the element is set for all pages.
190
-
191
- % \usepackage{lipsum}
203
+ \fancyhf{}
204
+ \fancyhead[L]{\galaazmaybeheaderlogo}
205
+ \fancyhead[R]{\galaazmayberighthead}
206
+ \renewcommand{\headrulewidth}{0.3pt}
207
+ \makeatletter
208
+ \renewcommand{\headrule}{%
209
+ \ifnum\value{page}<\galaazheaderfrompage\relax
210
+ \else
211
+ \hrule\@height\headrulewidth\@width\headwidth
212
+ \vskip-\headrulewidth
213
+ \fi
214
+ }
215
+ \makeatother
216
+ % First page often uses plain; same conditional header logic.
217
+ \fancypagestyle{plain}{%
218
+ \fancyhf{}%
219
+ \fancyhead[L]{\galaazmaybeheaderlogo}%
220
+ \fancyhead[R]{\galaazmayberighthead}%
221
+ \renewcommand{\headrulewidth}{0.3pt}%
222
+ }
192
223
 
193
224
  % make available command lastpage
194
225
  \usepackage{lastpage}
@@ -233,6 +264,10 @@
233
264
 
234
265
  %
235
266
  %\newcommand{\atraso}[1]{\color{red} \textbf {Tempo desde a Assinatura do Contrato: #1 dias}}
267
+ % No header on title/TOC (p.1) or splash logo page (p.2);
268
+ % logo + page number + section title from page 3 onward.
269
+ % Load after galaaz.sty.
270
+ \renewcommand{\galaazheaderfrompage}{3}
236
271
  \usepackage{booktabs}
237
272
  \usepackage{longtable}
238
273
  \usepackage{array}
@@ -274,6 +309,8 @@
274
309
  \setcounter{tocdepth}{3}
275
310
  \tableofcontents
276
311
  }
312
+ \begin{center}\includegraphics[width=0.45\linewidth]{images/galaaz-lockup-stacked} \end{center}
313
+
277
314
  \section{Introduction}\label{introduction}
278
315
 
279
316
  Galaaz is a system for tightly coupling Ruby and R. Ruby is a powerful
@@ -607,8 +644,9 @@ gatekeeper}. You do not need a git clone.
607
644
  Compile the native gatekeeper from the installed gem:
608
645
 
609
646
  \begin{verbatim}
610
- gem_dir="$(ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path")"
611
- # under JRuby: gem_dir="$(jruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path")"
647
+ gem_dir="$(ruby -e \
648
+ "puts Gem::Specification.find_by_name('galaaz').full_gem_path")"
649
+ # under JRuby: use jruby -e instead of ruby -e
612
650
  make -C "${gem_dir}/ext/new_bridge" all
613
651
  \end{verbatim}
614
652
  \item
@@ -990,37 +1028,21 @@ methods still await by default and return the \texttt{Job}.
990
1028
 
991
1029
  \begin{Shaded}
992
1030
  \begin{Highlighting}[]
993
- \NormalTok{coef }\OperatorTok{=} \ConstantTok{R}\OperatorTok{::}\DataTypeTok{Job}\AttributeTok{.eval}\NormalTok{(}\OperatorTok{\textless{}\textless{}\textasciitilde{}}\ControlFlowTok{R}\DocumentationTok{) \{ |job| job.load\_rds \}}
994
- \DocumentationTok{ fit \textless{}{-} lm(mpg \textasciitilde{} wt, data = mtcars)}
995
- \DocumentationTok{ saveRDS(unname(coef(fit)), result\_path)}
996
- \ControlFlowTok{R}
997
- \FunctionTok{puts}\NormalTok{ coef}
1031
+ \ControlFlowTok{begin}
1032
+ \NormalTok{ coef }\OperatorTok{=} \ConstantTok{R}\OperatorTok{::}\DataTypeTok{Job}\AttributeTok{.eval}\NormalTok{(}\OperatorTok{\textless{}\textless{}\textasciitilde{}}\ControlFlowTok{R}\DocumentationTok{) \{ |job| job.load\_rds \}}
1033
+ \DocumentationTok{ fit \textless{}{-} lm(mpg \textasciitilde{} wt, data = mtcars)}
1034
+ \DocumentationTok{ saveRDS(unname(coef(fit)), result\_path)}
1035
+ \DocumentationTok{ }\ControlFlowTok{R}
1036
+ \FunctionTok{puts}\NormalTok{ coef}
1037
+ \ControlFlowTok{rescue} \OperatorTok{=\textgreater{}}\NormalTok{ e}
1038
+ \FunctionTok{puts}\NormalTok{ e}\AttributeTok{.class.to\_s}
1039
+ \NormalTok{ e}\AttributeTok{.message.to\_s.scan}\NormalTok{(}\SpecialStringTok{/.\{1,68\}/}\NormalTok{)}\AttributeTok{.each} \OperatorTok{\{} \OperatorTok{|}\NormalTok{line}\OperatorTok{|} \FunctionTok{puts}\NormalTok{ line }\OperatorTok{\}}
1040
+ \ControlFlowTok{end}
998
1041
  \end{Highlighting}
999
1042
  \end{Shaded}
1000
1043
 
1001
1044
  \begin{verbatim}
1002
- ## Permission denied - /home/rbotafogo/.local/share/galaaz/jobs/eval-20260908T145009-4153-db9080
1003
- \end{verbatim}
1004
-
1005
- \begin{verbatim}
1006
- ## org/jruby/RubyDir.java:693:in 'mkdir'
1007
- ## /home/rbotafogo/.asdf/installs/ruby/jruby-10.1.1.0/lib/ruby/stdlib/fileutils.rb:403:in 'fu_mkdir'
1008
- ## /home/rbotafogo/.asdf/installs/ruby/jruby-10.1.1.0/lib/ruby/stdlib/fileutils.rb:381:in 'block in mkdir_p'
1009
- ## org/jruby/RubyArrayNative.java:1807:in 'reverse_each'
1010
- ## /home/rbotafogo/.asdf/installs/ruby/jruby-10.1.1.0/lib/ruby/stdlib/fileutils.rb:379:in 'block in mkdir_p'
1011
- ## org/jruby/RubyArrayNative.java:1729:in 'each'
1012
- ## /home/rbotafogo/.asdf/installs/ruby/jruby-10.1.1.0/lib/ruby/stdlib/fileutils.rb:371:in 'mkdir_p'
1013
- ## /home/rbotafogo/desenv_linux/galaaz/lib/R_interface/r_job.rb:140:in 'initialize'
1014
- ## /home/rbotafogo/desenv_linux/galaaz/lib/R_interface/r_job.rb:94:in 'eval'
1015
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:170:in 'exec_ruby'
1016
- ## org/jruby/RubyKernel.java:1459:in 'eval'
1017
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:169:in 'exec_ruby'
1018
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:777:in 'block in initialize'
1019
- ## org/jruby/RubyBasicObject.java:2713:in 'instance_eval'
1020
- ## org/jruby/RubyBasicObject.java:2741:in 'instance_eval'
1021
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:748:in 'block in initialize'
1022
- ## /home/rbotafogo/desenv_linux/galaaz/lib/R_interface/new_bridge_adapter.rb:371:in 'block in register_callback_proc_stub'
1023
- ## /home/rbotafogo/desenv_linux/galaaz/lib/new_bridge/session_client.rb:458:in 'block in handle_call'
1045
+ ## [1] 37.285126 -5.344472
1024
1046
  \end{verbatim}
1025
1047
 
1026
1048
  \begin{Shaded}
@@ -2707,26 +2729,20 @@ error.
2707
2729
 
2708
2730
  \begin{Shaded}
2709
2731
  \begin{Highlighting}[]
2710
- \NormalTok{vec }\OperatorTok{=} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\DecValTok{1}\NormalTok{, hello, }\DecValTok{5}\NormalTok{)}
2732
+ \ControlFlowTok{begin}
2733
+ \NormalTok{ vec }\OperatorTok{=} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\DecValTok{1}\NormalTok{, hello, }\DecValTok{5}\NormalTok{)}
2734
+ \ControlFlowTok{rescue} \OperatorTok{=\textgreater{}}\NormalTok{ e}
2735
+ \FunctionTok{puts}\NormalTok{ e}\AttributeTok{.class.to\_s}
2736
+ \NormalTok{ e}\AttributeTok{.message.to\_s.scan}\NormalTok{(}\SpecialStringTok{/.\{1,68\}/}\NormalTok{)}\AttributeTok{.each} \OperatorTok{\{} \OperatorTok{|}\NormalTok{line}\OperatorTok{|} \FunctionTok{puts}\NormalTok{ line }\OperatorTok{\}}
2737
+ \ControlFlowTok{end}
2711
2738
  \end{Highlighting}
2712
2739
  \end{Shaded}
2713
2740
 
2714
2741
  \begin{verbatim}
2742
+ ## NameError
2715
2743
  ## undefined local variable or method 'hello' for an instance of RC
2716
2744
  \end{verbatim}
2717
2745
 
2718
- \begin{verbatim}
2719
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:170:in 'exec_ruby'
2720
- ## org/jruby/RubyKernel.java:1459:in 'eval'
2721
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:169:in 'exec_ruby'
2722
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:777:in 'block in initialize'
2723
- ## org/jruby/RubyBasicObject.java:2713:in 'instance_eval'
2724
- ## org/jruby/RubyBasicObject.java:2741:in 'instance_eval'
2725
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:748:in 'block in initialize'
2726
- ## /home/rbotafogo/desenv_linux/galaaz/lib/R_interface/new_bridge_adapter.rb:371:in 'block in register_callback_proc_stub'
2727
- ## /home/rbotafogo/desenv_linux/galaaz/lib/new_bridge/session_client.rb:458:in 'block in handle_call'
2728
- \end{verbatim}
2729
-
2730
2746
  Here is a vector with logical values
2731
2747
 
2732
2748
  \begin{Shaded}
@@ -4766,11 +4782,17 @@ definition of `mutate\_y' above:
4766
4782
  \begin{Shaded}
4767
4783
  \begin{Highlighting}[]
4768
4784
  \NormalTok{a }\OperatorTok{=} \DecValTok{10}
4769
- \NormalTok{mutate\_y(df1)}
4785
+ \ControlFlowTok{begin}
4786
+ \NormalTok{ mutate\_y(df1)}
4787
+ \ControlFlowTok{rescue} \OperatorTok{=\textgreater{}}\NormalTok{ e}
4788
+ \FunctionTok{puts}\NormalTok{ e}\AttributeTok{.class.to\_s}
4789
+ \NormalTok{ e}\AttributeTok{.message.to\_s.scan}\NormalTok{(}\SpecialStringTok{/.\{1,68\}/}\NormalTok{)}\AttributeTok{.each} \OperatorTok{\{} \OperatorTok{|}\NormalTok{line}\OperatorTok{|} \FunctionTok{puts}\NormalTok{ line }\OperatorTok{\}}
4790
+ \ControlFlowTok{end}
4770
4791
  \end{Highlighting}
4771
4792
  \end{Shaded}
4772
4793
 
4773
4794
  \begin{verbatim}
4795
+ ## NewBridge::SessionClient::RProcessError
4774
4796
  ## Error: i In argument: `y = a + x`.
4775
4797
  ## Caused by error:
4776
4798
  ## ! object 'a' not found
@@ -9,9 +9,17 @@ output:
9
9
  html_document:
10
10
  self_contained: true
11
11
  keep_md: true
12
+ toc: true
13
+ toc_float: true
14
+ toc_depth: 2
15
+ number_sections: true
16
+ includes:
17
+ before_body: _logo_before_body.html
12
18
  pdf_document:
13
19
  includes:
14
- in_header: ["../../sty/galaaz.sty"]
20
+ in_header:
21
+ - "../../sty/galaaz.sty"
22
+ - "../../sty/galaaz-headers-from-p3.tex"
15
23
  keep_tex: yes
16
24
  number_sections: yes
17
25
  toc: true
@@ -29,6 +37,11 @@ library('dplyr')
29
37
  library('tibble')
30
38
  ```
31
39
 
40
+ ```{r brand_logo, echo=FALSE, fig.align='center', out.width='45%', eval=knitr::is_latex_output()}
41
+ # PDF only — HTML uses _logo_before_body.html (above the TOC).
42
+ knitr::include_graphics("images/galaaz-lockup-stacked.png")
43
+ ```
44
+
32
45
  # Introduction
33
46
 
34
47
  According to Steven Sagaert’s answer on Quora about “Is programming language R overrated?”: