galaaz 2.1.7 → 2.1.8

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +63 -58
  4. data/blogs/galaaz_ggplot/galaaz_ggplot.log +59 -68
  5. data/blogs/galaaz_ggplot/galaaz_ggplot.md +91 -84
  6. data/blogs/galaaz_ggplot/galaaz_ggplot.tex +125 -94
  7. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
  8. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
  9. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
  10. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
  11. data/blogs/gknit/gknit.Rmd +33 -28
  12. data/blogs/gknit/gknit.md +47 -42
  13. data/blogs/gknit/gknit.tex +1368 -0
  14. data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
  15. data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
  16. data/blogs/gknit/gknit_files/figure-latex/bubble-1.png +0 -0
  17. data/blogs/gknit/gknit_files/gknit_files/figure-latex/bubble-1.png +0 -0
  18. data/blogs/manual/manual.Rmd +129 -60
  19. data/blogs/manual/manual.log +289 -545
  20. data/blogs/manual/manual.md +551 -467
  21. data/blogs/manual/manual.tex +1059 -485
  22. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  23. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  24. data/blogs/manual/manual_files/figure-markdown_github/bubble-1.png +0 -0
  25. data/blogs/manual/manual_files/figure-markdown_github/diverging_bar.png +0 -0
  26. data/blogs/manual/manual_files/manual_files/figure-latex/bubble-1.png +0 -0
  27. data/blogs/nse_dplyr/nse_dplyr.Rmd +28 -7
  28. data/blogs/nse_dplyr/nse_dplyr.log +49 -153
  29. data/blogs/nse_dplyr/nse_dplyr.md +676 -705
  30. data/blogs/nse_dplyr/nse_dplyr.tex +1589 -0
  31. data/blogs/oh_my/oh_my.Rmd +193 -55
  32. data/blogs/oh_my/oh_my.log +265 -95
  33. data/blogs/oh_my/oh_my.md +236 -95
  34. data/blogs/oh_my/oh_my.tex +1976 -68
  35. data/blogs/ruby_plot/ruby_plot.Rmd +42 -34
  36. data/blogs/ruby_plot/ruby_plot.log +101 -99
  37. data/blogs/ruby_plot/ruby_plot.md +52 -46
  38. data/blogs/ruby_plot/ruby_plot.tex +134 -102
  39. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
  40. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
  41. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
  42. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
  43. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
  44. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
  45. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  46. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
  47. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
  48. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  49. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  50. data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
  51. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  52. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  53. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  54. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  55. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  56. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  57. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  58. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  59. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  60. data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  61. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/dose_len.png +0 -0
  62. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  63. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  64. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  65. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  66. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  67. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  68. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  69. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  70. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  71. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  72. data/lib/galaaz/cli.rb +51 -10
  73. data/script/omarchy/README.md +1 -1
  74. data/script/omarchy/galaaz-guide.sh +1 -1
  75. data/sty/galaaz.sty +22 -0
  76. data/version.rb +1 -1
  77. metadata +19 -1
@@ -26,16 +26,15 @@ general-purpose programming language. It was designed and developed in the mid-1
26
26
  "Matz" Matsumoto in Japan." It reached high popularity with the development of Ruby on Rails
27
27
  (RoR) by David Heinemeier Hansson. RoR is a web application framework first released
28
28
  around 2005. It makes extensive use of Ruby's metaprogramming features. With RoR,
29
- Ruby became very popular. According to [Ruby's Tiobe index](https://www.tiobe.com/tiobe-index/ruby/)
30
- it peeked in popularity around 2008, then declined until 2015 when it started picking up again.
31
- At the time of this writing (November 2018), the Tiobe index puts Ruby in 16th position as
32
- most popular language.
29
+ Ruby became very popular. According to [Ruby’s ranking in the TIOBE index](https://www.tiobe.com/tiobe-index/ruby/)
30
+ it **peaked** in popularity around 2008, then declined until 2015 when it started picking up again.
31
+ As of the original publication date (November 2018), TIOBE placed Ruby around 16th among languages.
33
32
 
34
- Python, a language similar to Ruby, ranks 4th in the index. Java, C and C++ take the
35
- first three positions. Ruby is often criticized for its focus on web applications.
33
+ Python, often grouped with Ruby as a high-level scripting language, ranked higher in that same snapshot.
34
+ Ruby is often criticized for its focus on web applications.
36
35
  But Ruby can do [much more](https://github.com/markets/awesome-ruby) than just web applications.
37
- Yet, for scientific computing, Ruby lags way behind Python and R. Python has
38
- Django framework for web, NumPy for numerical arrays, Pandas for data analysis.
36
+ Yet, for scientific computing, Ruby lags behind Python and R. Python combines web frameworks such as
37
+ Django with NumPy, pandas, SciPy, and **a very large ecosystem** of domain-specific packages.
39
38
  R is a free software environment for statistical computing and graphics with thousands
40
39
  of libraries for data analysis.
41
40
 
@@ -53,7 +52,7 @@ Ruby and R could share one JVM runtime. That stack is **no longer** what Galaaz
53
52
  today’s Galaaz is developed and tested with **JRuby or CRuby + GNU R** (see the project manual for
54
53
  setup and command-line tools).
55
54
 
56
- Library wrapping is a usual way of bringing features from one language into another.
55
+ Library wrapping is a common way to bring features from one language into another.
57
56
  To improve performance, Python often wraps more efficient C libraries. For the
58
57
  Python developer, the existence of such C libraries is hidden. The problem with
59
58
  library wrapping is that for any new library, there is the need to handcraft a new
@@ -64,7 +63,7 @@ in Ruby. Doing so, all thousands of R libraries are available immediately
64
63
  to Ruby developers without any new wrapping effort.
65
64
 
66
65
  To show the power of Galaaz, we show in this article how Ruby can use R's ggplot2
67
- library tranparantly bringing to Ruby the power of high quality scientific plotting.
66
+ library **transparently**, bringing to Ruby the power of high-quality scientific plotting.
68
67
  We also show that migrating from R to Ruby with Galaaz is a matter of small
69
68
  syntactic changes. By using Ruby, the R developer can use all of Ruby's powerful
70
69
  object-oriented features. Also, with Ruby, it becomes much easier to move code
@@ -86,8 +85,8 @@ language and don't need special knowledge.
86
85
 
87
86
  _Knitr_ is an application that converts text written in rmarkdown to many
88
87
  different output formats. For instance, a writer can convert an rmarkdown document
89
- to HTML, $LaTex$, docx and many other formats. Rmarkdown documents can contain
90
- text and _code chunks_. Knitr formats code chunks in a grayed box in the output document.
88
+ to HTML, LaTeX, Word, and many other formats. R Markdown documents can contain
89
+ text and _code chunks_. knitr formats code chunks in a shaded box in the output document.
91
90
  It also executes the code chunks and formats the output in a white box. Every line of
92
91
  output from the execution code is preceded by '##'.
93
92
 
@@ -101,7 +100,7 @@ With _gKnit_ Ruby code chunks can share data.
101
100
  # Exploring the Dataset
102
101
 
103
102
  Let's start by exploring our selected dataset. ToothGrowth is an R dataset. A dataset
104
- is like a simple excel spreadsheet, in which each column has only one type of data.
103
+ is like a simple Excel spreadsheet, in which each column has only one type of data.
105
104
  For instance one column can have float, the other integer, and a third strings.
106
105
  This dataset analyzes the length of odontoblasts (cells responsible for tooth growth)
107
106
  in 60 guinea pigs, where each animal received one of three dose levels of Vitamin C
@@ -110,7 +109,7 @@ in 60 guinea pigs, where each animal received one of three dose levels of Vitami
110
109
 
111
110
  The ToothGrowth dataset contains three columns: 'len', 'supp' and 'dose'. Let's
112
111
  take a look at a few rows of this dataset. In Galaaz, R variables are accessed
113
- by using the corresponding Ruby symbol preceeded by the tilda ('~') function. Note in the
112
+ by using the corresponding Ruby symbol with the tilde (`~`) operator. Note in the
114
113
  following chunk that 'ToothGrowth' is the R variable and Ruby's 'tooth_growth' is
115
114
  assigned the value of '~R[:ToothGrowth]'.
116
115
 
@@ -152,7 +151,7 @@ puts tooth_growth.len.head
152
151
 
153
152
  The 'dose' column contains a numeric value with either, 0.5, 1 or 2, although the
154
153
  first 6 rows as seen above only contain the 0.5 values. Even though those are
155
- 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'.
154
+ 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'.
156
155
  In R, the function 'as.factor' is used to convert data in a vector to factors. To use this
157
156
  function from Galaaz the dot ('.') in the function name is substituted by '__' (double underline).
158
157
  The function 'as.factor' becomes 'R.as__factor' or just 'as__factor' when chaining.
@@ -225,7 +224,7 @@ to form the final graphics.
225
224
  In order to make a plot, we use the 'ggplot' function to the dataset. In R, this would be
226
225
  written as ```ggplot(<dataset>, ...)```. Galaaz gives you the flexibility to use
227
226
  either ```R.ggplot(<dataset>, ...)``` or ```<dataset>.ggplot(...)```. In the graph
228
- specification bellow, we use the second notation that looks more like Ruby.
227
+ specification below, we use the second notation that looks more like Ruby.
229
228
  ggplot uses the ‘aes’ method to specify
230
229
  x and y axes; in this case, the 'dose' on the $x$ axis and the 'length' on
231
230
  the $y$ axis: 'E.aes(x: :dose, y: :len)'. To specify the type of plot add a geom to
@@ -405,8 +404,9 @@ matches with the actual order of the colors in the plot.
405
404
 
406
405
  ``` ruby
407
406
  bp = bp +
408
- R.scale_fill_manual(values: R.c("cyan", "deepskyblue", "deepskyblue4"),
409
- breaks: R.c("2","1","0.5"))
407
+ R.scale_fill_manual(
408
+ values: R.c("cyan", "deepskyblue", "deepskyblue4"),
409
+ breaks: R.c("2", "1", "0.5"))
410
410
 
411
411
  puts bp
412
412
  ```
@@ -433,11 +433,13 @@ a boxplot known as a _violin plot_ with jittered data.
433
433
 
434
434
 
435
435
  ``` ruby
436
- violin = base_tooth + R.geom_violin(E.aes(fill: :dose)) +
436
+ violin = base_tooth +
437
+ R.geom_violin(E.aes(fill: :dose)) +
437
438
  R.facet_grid(R[:all].til :supp) +
438
439
  R.geom_jitter(shape: 23, color: "cyan3", size: 1) +
439
- R.scale_fill_manual(values: R.c("cyan", "deepskyblue", "deepskyblue4"),
440
- breaks: R.c("2","1","0.5"))
440
+ R.scale_fill_manual(
441
+ values: R.c("cyan", "deepskyblue", "deepskyblue4"),
442
+ breaks: R.c("2", "1", "0.5"))
441
443
 
442
444
  puts violin
443
445
  ```
@@ -502,42 +504,43 @@ written in 'bold'.
502
504
  module CorpTheme
503
505
 
504
506
  R.install_and_loads 'RColorBrewer'
505
-
506
- #---------------------------------------------------------------------------------
507
- # face can be (1=plain, 2=bold, 3=italic, 4=bold-italic)
508
- #---------------------------------------------------------------------------------
509
-
507
+
508
+ # ---------------------------------------------------------------
509
+ # face: 1=plain, 2=bold, 3=italic, 4=bold-italic
510
+ # ---------------------------------------------------------------
511
+
510
512
  def self.text_element(size, face: "plain", hjust: nil)
511
- E.element_text(color: "#000080",
513
+ E.element_text(color: "#000080",
512
514
  face: face,
513
515
  size: size,
514
- hjust: hjust)
516
+ hjust: hjust)
515
517
  end
516
-
517
- #---------------------------------------------------------------------------------
518
- # Defines the plot theme (visualization). In this theme we remove major and minor
519
- # grids, borders and background. We also turn-off scientific notation.
520
- #---------------------------------------------------------------------------------
521
-
518
+
519
+ # ---------------------------------------------------------------
520
+ # Plot theme: no major/minor grids or borders; optional
521
+ # background for facets; turn off scientific notation.
522
+ # ---------------------------------------------------------------
523
+
522
524
  def self.global_theme(faceted = false)
523
-
525
+
524
526
  R.options(scipen: 999) # turn-off scientific notation like 1e+48
525
- # R.theme_set(R.theme_bw)
526
-
527
+ # R.theme_set(R.theme_bw)
528
+
527
529
  # remove major grids
528
530
  gb = R.theme(panel__grid__major: E.element_blank())
529
531
  # remove minor grids
530
532
  gb = gb + R.theme(panel__grid__minor: E.element_blank)
531
- # gb = R.theme(panel__grid__minor: E.element_blank)
532
533
  # remove border
533
534
  gb = gb + R.theme(panel__border: E.element_blank)
534
- # remove background. When working with faceted graphs, the background makes
535
- # it easier to see each facet, so leave it
536
- gb = gb + R.theme(panel__background: E.element_blank) if !faceted
535
+ # Keep background on faceted plots (helps separate facets)
536
+ if !faceted
537
+ gb = gb + R.theme(panel__background: E.element_blank)
538
+ end
537
539
  # Change axis font
538
540
  gb = gb + R.theme(axis__text: text_element(8))
539
541
  # change axis title font
540
- gb = gb + R.theme(axis__title: text_element(10, face: "bold", hjust: 1))
542
+ gb = gb + R.theme(
543
+ axis__title: text_element(10, face: "bold", hjust: 1))
541
544
  # change font of title
542
545
  gb = gb + R.theme(title: text_element(12, face: "bold"))
543
546
  # change font of subtitle
@@ -546,7 +549,7 @@ module CorpTheme
546
549
  gb = gb + R.theme(plot__caption: text_element(8))
547
550
 
548
551
  end
549
-
552
+
550
553
  end
551
554
  ```
552
555
 
@@ -593,9 +596,12 @@ Length of odontoblasts in 60 guinea pigs.
593
596
  Each animal received one of three dose levels of vitamin C.
594
597
  EOT
595
598
 
596
- bp = tooth_growth.ggplot(E.aes(x: :supp, y: :len, group: :supp)) +
597
- R.geom_boxplot(E.aes(fill: :supp)) + R.facet_grid(R[:all].til :dose) +
598
- R.scale_fill_manual(values: R.c("cyan", "deepskyblue4")) +
599
+ bp = tooth_growth.ggplot(
600
+ E.aes(x: :supp, y: :len, group: :supp)) +
601
+ R.geom_boxplot(E.aes(fill: :supp)) +
602
+ R.facet_grid(R[:all].til :dose) +
603
+ R.scale_fill_manual(
604
+ values: R.c("cyan", "deepskyblue4")) +
599
605
  R.labs(title: "Tooth Growth: Length by Dose",
600
606
  subtitle: "Faceted by dose",
601
607
  x: "Delivery method", y: "Teeth length",