galaaz 2.1.7 → 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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -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 +76 -58
  13. data/blogs/galaaz_ggplot/galaaz_ggplot.md +188 -161
  14. data/blogs/galaaz_ggplot/galaaz_ggplot.tex +185 -117
  15. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
  16. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
  17. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
  18. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
  19. data/blogs/galaaz_ggplot/images/galaaz-lockup-stacked.png +0 -0
  20. data/blogs/gknit/gknit.Rmd +48 -28
  21. data/blogs/gknit/gknit.md +60 -43
  22. data/blogs/gknit/gknit.tex +1409 -0
  23. data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
  24. data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
  25. data/blogs/gknit/gknit_files/figure-latex/bubble-1.png +0 -0
  26. data/blogs/gknit/images/galaaz-lockup-stacked.png +0 -0
  27. data/blogs/manual/images/galaaz-lockup-stacked.png +0 -0
  28. data/blogs/manual/manual.Rmd +161 -71
  29. data/blogs/manual/manual.md +573 -482
  30. data/blogs/manual/manual.tex +1113 -517
  31. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  32. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  33. data/blogs/manual/manual_files/figure-markdown_github/bubble-1.png +0 -0
  34. data/blogs/manual/manual_files/figure-markdown_github/diverging_bar.png +0 -0
  35. data/blogs/nse_dplyr/images/galaaz-lockup-stacked.png +0 -0
  36. data/blogs/nse_dplyr/nse_dplyr.Rmd +42 -8
  37. data/blogs/nse_dplyr/nse_dplyr.md +69 -50
  38. data/blogs/nse_dplyr/nse_dplyr.tex +1626 -0
  39. data/blogs/oh_my/images/galaaz-lockup-stacked.png +0 -0
  40. data/blogs/oh_my/oh_my.Rmd +206 -55
  41. data/blogs/oh_my/oh_my.md +247 -96
  42. data/blogs/oh_my/oh_my.tex +2038 -93
  43. data/blogs/r_on_rails_ledger/images/00_portfolio_page.png +0 -0
  44. data/blogs/r_on_rails_ledger/images/01_results_panel.png +0 -0
  45. data/blogs/r_on_rails_ledger/images/02_density_tail_risk.png +0 -0
  46. data/blogs/r_on_rails_ledger/images/03_mc_cone.png +0 -0
  47. data/blogs/r_on_rails_ledger/images/04_rolling_var.png +0 -0
  48. data/blogs/r_on_rails_ledger/images/galaaz-lockup-stacked.png +0 -0
  49. data/blogs/r_on_rails_ledger/r_on_rails_ledger.Rmd +354 -0
  50. data/blogs/r_on_rails_ledger/r_on_rails_ledger.md +365 -0
  51. data/blogs/r_on_rails_ledger/r_on_rails_ledger.tex +670 -0
  52. data/blogs/ruby_plot/images/galaaz-lockup-stacked.png +0 -0
  53. data/blogs/ruby_plot/ruby_plot.Rmd +56 -35
  54. data/blogs/ruby_plot/ruby_plot.md +63 -47
  55. data/blogs/ruby_plot/ruby_plot.tex +194 -125
  56. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
  57. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
  58. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
  59. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
  60. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
  61. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
  62. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  63. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
  64. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
  65. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  66. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  67. data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
  68. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  69. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  70. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  71. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  72. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  73. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  74. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  75. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  76. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  77. data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  78. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/dose_len.png +0 -0
  79. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  80. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  81. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  82. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  83. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  84. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  85. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  86. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  87. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  88. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  89. data/lib/galaaz/cli.rb +98 -13
  90. data/logos/icon-font/README.md +27 -0
  91. data/logos/icon-font/build_font.py +130 -0
  92. data/logos/icon-font/galaaz-mark.svg +34 -0
  93. data/script/omarchy/README.md +9 -2
  94. data/script/omarchy/fonts/galaaz.ttf +0 -0
  95. data/script/omarchy/galaaz-guide.sh +1 -1
  96. data/script/omarchy/install-galaaz.sh +8 -1
  97. data/script/omarchy/omarchy-menu.jsonc +21 -9
  98. data/sty/galaaz-header.png +0 -0
  99. data/sty/galaaz-headers-from-p3.tex +4 -0
  100. data/sty/galaaz.sty +76 -23
  101. data/version.rb +1 -1
  102. metadata +46 -7
  103. data/blogs/galaaz_ggplot/galaaz_ggplot.log +0 -754
  104. data/blogs/manual/manual.log +0 -1786
  105. data/blogs/nse_dplyr/nse_dplyr.log +0 -928
  106. data/blogs/oh_my/oh_my.log +0 -804
  107. data/blogs/ruby_plot/ruby_plot.log +0 -885
@@ -9,9 +9,18 @@ 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"
23
+ keep_tex: yes
15
24
  number_sections: yes
16
25
  toc: true
17
26
  toc_depth: 2
@@ -23,10 +32,16 @@ fontsize: 11pt
23
32
  ```{r setup, echo=FALSE, message = FALSE}
24
33
  #R.options(crayon__enabled: false)
25
34
  options(crayon.enabled = FALSE)
35
+ options(width = 70)
26
36
  library('dplyr')
27
37
  library('tibble')
28
38
  ```
29
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
+
30
45
  # Introduction
31
46
 
32
47
  According to Steven Sagaert’s answer on Quora about “Is programming language R overrated?”:
@@ -207,8 +222,13 @@ The code below creates an expression summing two symbols. Note that :a and :b ar
207
222
  are not bound to any values at the time of expression definition:
208
223
 
209
224
  ```{ruby expressions}
210
- exp1 = :a + :b
211
- puts exp1
225
+ begin
226
+ exp1 = :a + :b
227
+ puts exp1
228
+ rescue => e
229
+ # Bare Symbol#+ is not expression sugar in Galaaz 2.0; short error for PDF.
230
+ puts "#{e.class}: #{e.message}"
231
+ end
212
232
  ```
213
233
  In Galaaz, we can build any complex mathematical expression such as:
214
234
 
@@ -514,7 +534,8 @@ In Galaaz the method mutate_y below will work fine and will never fail silently.
514
534
 
515
535
  ```{ruby mutate_y, warning=FALSE}
516
536
  def mutate_y(df)
517
- # Mutate column names are Ruby kwargs (y: …). Use .assign only for R `<-` expressions.
537
+ # Column names are Ruby kwargs (y: …).
538
+ # Use .assign only for R `<-` expressions.
518
539
  df.mutate(y: R[:a] + R[:x])
519
540
  end
520
541
  ```
@@ -531,7 +552,12 @@ definition of 'mutate\_y' above:
531
552
 
532
553
  ```{ruby call_mutate_y, warning = FALSE}
533
554
  a = 10
534
- mutate_y(df1)
555
+ begin
556
+ mutate_y(df1)
557
+ rescue => e
558
+ # Short message only — full backtraces overflow PDF code boxes.
559
+ puts "#{e.class}: #{e.message}"
560
+ end
535
561
  ```
536
562
  ## Different expressions
537
563
 
@@ -794,11 +820,19 @@ def grouped_mean(data, grouping_variables, value_variables)
794
820
  data.
795
821
  group_by_at(grouping_variables).
796
822
  mutate(count: E.n).
797
- summarise_at(E.c(value_variables, "count"), R[:mean], na__rm: true).
798
- rename_at(value_variables, E.funs(E.paste0("mean_", value_variables)))
823
+ summarise_at(
824
+ E.c(value_variables, "count"),
825
+ R[:mean],
826
+ na__rm: true).
827
+ rename_at(
828
+ value_variables,
829
+ E.funs(E.paste0("mean_", value_variables)))
799
830
  end
800
831
 
801
- puts grouped_mean((~R[:starwars]), "eye_color", E.c("mass", "birth_year"))
832
+ puts grouped_mean(
833
+ (~R[:starwars]),
834
+ "eye_color",
835
+ E.c("mass", "birth_year"))
802
836
  ```
803
837
 
804
838
  # Further reading
@@ -9,9 +9,18 @@ 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"
23
+ keep_tex: yes
15
24
  number_sections: yes
16
25
  toc: true
17
26
  toc_depth: 2
@@ -22,6 +31,8 @@ fontsize: 11pt
22
31
 
23
32
 
24
33
 
34
+
35
+
25
36
  # Introduction
26
37
 
27
38
  According to Steven Sagaert’s answer on Quora about “Is programming language R overrated?”:
@@ -205,24 +216,17 @@ are not bound to any values at the time of expression definition:
205
216
 
206
217
 
207
218
  ``` ruby
208
- exp1 = :a + :b
209
- puts exp1
210
- ```
211
-
212
- ```
213
- ## undefined method '+' for an instance of Symbol
219
+ begin
220
+ exp1 = :a + :b
221
+ puts exp1
222
+ rescue => e
223
+ # Bare Symbol#+ is not expression sugar in Galaaz 2.0; short error for PDF.
224
+ puts "#{e.class}: #{e.message}"
225
+ end
214
226
  ```
215
227
 
216
228
  ```
217
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:170:in 'exec_ruby'
218
- ## org/jruby/RubyKernel.java:1268:in 'eval'
219
- ## /home/rbotafogo/desenv_linux/galaaz/lib/util/exec_ruby.rb:169:in 'exec_ruby'
220
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:777:in 'block in initialize'
221
- ## org/jruby/RubyBasicObject.java:2695:in 'instance_eval'
222
- ## org/jruby/RubyBasicObject.java:2723:in 'instance_eval'
223
- ## /home/rbotafogo/desenv_linux/galaaz/lib/gknit/knitr_engine.rb:748:in 'block in initialize'
224
- ## /home/rbotafogo/desenv_linux/galaaz/lib/R_interface/new_bridge_adapter.rb:358:in 'block in register_callback_proc_stub'
225
- ## /home/rbotafogo/desenv_linux/galaaz/lib/new_bridge/session_client.rb:413:in 'block in handle_call'
229
+ ## NoMethodError: undefined method '+' for an instance of Symbol
226
230
  ```
227
231
  In Galaaz, we can build any complex mathematical expression such as:
228
232
 
@@ -496,7 +500,7 @@ puts ~R[:flights].dim
496
500
 
497
501
  ```
498
502
  ## ~(dim(flights))
499
- ## <environment: 0x5f0b6a5b7790>
503
+ ## <environment: 0x5cd09170df98>
500
504
  ```
501
505
 
502
506
  Now, let's use a first verb of _dplyr_: 'filter'. This verb, obviously, will filter the data
@@ -515,22 +519,23 @@ puts R.filter(:flights, (R[:month].eq 1), (R[:day].eq 1))
515
519
 
516
520
  ```
517
521
  ## # A tibble: 842 × 19
518
- ## year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time
519
- ## <int> <int> <int> <int> <int> <dbl> <int> <int>
520
- ## 1 2013 1 1 517 515 2 830 819
521
- ## 2 2013 1 1 533 529 4 850 830
522
- ## 3 2013 1 1 542 540 2 923 850
523
- ## 4 2013 1 1 544 545 -1 1004 1022
524
- ## 5 2013 1 1 554 600 -6 812 837
525
- ## 6 2013 1 1 554 558 -4 740 728
526
- ## 7 2013 1 1 555 600 -5 913 854
527
- ## 8 2013 1 1 557 600 -3 709 723
528
- ## 9 2013 1 1 557 600 -3 838 846
529
- ## 10 2013 1 1 558 600 -2 753 745
522
+ ## year month day dep_time sched_dep_time dep_delay arr_time
523
+ ## <int> <int> <int> <int> <int> <dbl> <int>
524
+ ## 1 2013 1 1 517 515 2 830
525
+ ## 2 2013 1 1 533 529 4 850
526
+ ## 3 2013 1 1 542 540 2 923
527
+ ## 4 2013 1 1 544 545 -1 1004
528
+ ## 5 2013 1 1 554 600 -6 812
529
+ ## 6 2013 1 1 554 558 -4 740
530
+ ## 7 2013 1 1 555 600 -5 913
531
+ ## 8 2013 1 1 557 600 -3 709
532
+ ## 9 2013 1 1 557 600 -3 838
533
+ ## 10 2013 1 1 558 600 -2 753
530
534
  ## # ℹ 832 more rows
531
- ## # ℹ 11 more variables: arr_delay <dbl>, carrier <chr>, flight <int>,
532
- ## # tailnum <chr>, origin <chr>, dest <chr>, air_time <dbl>, distance <dbl>,
533
- ## # hour <dbl>, minute <dbl>, time_hour <dttm>
535
+ ## # ℹ 12 more variables: sched_arr_time <int>, arr_delay <dbl>,
536
+ ## # carrier <chr>, flight <int>, tailnum <chr>, origin <chr>,
537
+ ## # dest <chr>, air_time <dbl>, distance <dbl>, hour <dbl>,
538
+ ## # minute <dbl>, time_hour <dttm>
534
539
  ```
535
540
 
536
541
 
@@ -683,7 +688,8 @@ In Galaaz the method mutate_y below will work fine and will never fail silently.
683
688
 
684
689
  ``` ruby
685
690
  def mutate_y(df)
686
- # Mutate column names are Ruby kwargs (y: …). Use .assign only for R `<-` expressions.
691
+ # Column names are Ruby kwargs (y: …).
692
+ # Use .assign only for R `<-` expressions.
687
693
  df.mutate(y: R[:a] + R[:x])
688
694
  end
689
695
  ```
@@ -709,11 +715,16 @@ definition of 'mutate\_y' above:
709
715
 
710
716
  ``` ruby
711
717
  a = 10
712
- mutate_y(df1)
718
+ begin
719
+ mutate_y(df1)
720
+ rescue => e
721
+ # Short message only — full backtraces overflow PDF code boxes.
722
+ puts "#{e.class}: #{e.message}"
723
+ end
713
724
  ```
714
725
 
715
726
  ```
716
- ## Error: ℹ In argument: `y = a + x`.
727
+ ## NewBridge::SessionClient::RProcessError: Error: ℹ In argument: `y = a + x`.
717
728
  ## Caused by error:
718
729
  ## ! object 'a' not found
719
730
  ```
@@ -1046,16 +1057,16 @@ puts (~R[:starwars]).head
1046
1057
 
1047
1058
  ```
1048
1059
  ## # A tibble: 6 × 14
1049
- ## name height mass hair_color skin_color eye_color birth_year sex gender
1050
- ## <chr> <int> <dbl> <chr> <chr> <chr> <dbl> <chr> <chr>
1051
- ## 1 Luke Sky… 172 77 blond fair blue 19 male mascu…
1052
- ## 2 C-3PO 167 75 <NA> gold yellow 112 none mascu…
1053
- ## 3 R2-D2 96 32 <NA> white, bl… red 33 none mascu…
1054
- ## 4 Darth Va… 202 136 none white yellow 41.9 male mascu…
1055
- ## 5 Leia Org… 150 49 brown light brown 19 fema… femin…
1056
- ## 6 Owen Lars 178 120 brown, gr… light blue 52 male mascu…
1057
- ## # ℹ 5 more variables: homeworld <chr>, species <chr>, films <list>,
1058
- ## # vehicles <list>, starships <list>
1060
+ ## name height mass hair_color skin_color eye_color birth_year sex
1061
+ ## <chr> <int> <dbl> <chr> <chr> <chr> <dbl> <chr>
1062
+ ## 1 Luke … 172 77 blond fair blue 19 male
1063
+ ## 2 C-3PO 167 75 <NA> gold yellow 112 none
1064
+ ## 3 R2-D2 96 32 <NA> white, bl… red 33 none
1065
+ ## 4 Darth… 202 136 none white yellow 41.9 male
1066
+ ## 5 Leia … 150 49 brown light brown 19 fema…
1067
+ ## 6 Owen … 178 120 brown, gr… light blue 52 male
1068
+ ## # ℹ 6 more variables: gender <chr>, homeworld <chr>, species <chr>,
1069
+ ## # films <list>, vehicles <list>, starships <list>
1059
1070
  ```
1060
1071
  The grouped_mean function below will receive a grouping variable and calculate summaries for
1061
1072
  the value\_variables given:
@@ -1083,8 +1094,8 @@ gm = starwars %>%
1083
1094
  ## # Auto named with `tibble::lst()`: tibble::lst(mean, median)
1084
1095
  ##
1085
1096
  ## # Using lambdas list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
1086
- ## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
1087
- ## generated.
1097
+ ## Call `lifecycle::last_lifecycle_warnings()` to see where this warning
1098
+ ## was generated.
1088
1099
  ```
1089
1100
 
1090
1101
  ``` r
@@ -1118,11 +1129,19 @@ def grouped_mean(data, grouping_variables, value_variables)
1118
1129
  data.
1119
1130
  group_by_at(grouping_variables).
1120
1131
  mutate(count: E.n).
1121
- summarise_at(E.c(value_variables, "count"), R[:mean], na__rm: true).
1122
- rename_at(value_variables, E.funs(E.paste0("mean_", value_variables)))
1132
+ summarise_at(
1133
+ E.c(value_variables, "count"),
1134
+ R[:mean],
1135
+ na__rm: true).
1136
+ rename_at(
1137
+ value_variables,
1138
+ E.funs(E.paste0("mean_", value_variables)))
1123
1139
  end
1124
1140
 
1125
- puts grouped_mean((~R[:starwars]), "eye_color", E.c("mass", "birth_year"))
1141
+ puts grouped_mean(
1142
+ (~R[:starwars]),
1143
+ "eye_color",
1144
+ E.c("mass", "birth_year"))
1126
1145
  ```
1127
1146
 
1128
1147
  ```