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
data/blogs/gknit/gknit.md CHANGED
@@ -10,6 +10,7 @@ output:
10
10
  pdf_document:
11
11
  includes:
12
12
  in_header: ["../../sty/galaaz.sty"]
13
+ keep_tex: yes
13
14
  number_sections: yes
14
15
  html_document:
15
16
  self_contained: true
@@ -347,15 +348,17 @@ a linear regression line (method = "lm") for every manufacturer.
347
348
  library(ggplot2)
348
349
  data(mpg, package="ggplot2")
349
350
 
350
- mpg_select <- mpg[mpg$manufacturer %in% c("audi", "ford", "honda", "hyundai"), ]
351
+ mpg_select <- mpg[
352
+ mpg$manufacturer %in% c("audi", "ford", "honda", "hyundai"),
353
+ ]
351
354
 
352
355
  # Scatterplot
353
356
  theme_set(theme_bw()) # pre-set the bw theme.
354
- g <- ggplot(mpg_select, aes(displ, cty)) +
357
+ g <- ggplot(mpg_select, aes(displ, cty)) +
355
358
  labs(subtitle="mpg: Displacement vs City Mileage",
356
359
  title="Bubble chart")
357
360
 
358
- g + geom_jitter(aes(col=manufacturer, size=hwy)) +
361
+ g + geom_jitter(aes(col=manufacturer, size=hwy)) +
359
362
  geom_smooth(aes(col=manufacturer), method="lm", se=F)
360
363
  ```
361
364
 
@@ -479,60 +482,61 @@ ten aspects are:
479
482
  # copy the R variable :mtcars to the Ruby mtcars variable
480
483
  mtcars = ~R[:mtcars]
481
484
 
482
- # create a new column 'car_name' to store the car names so that it can be
483
- # used for plotting. The 'rownames' of the data frame cannot be used as
484
- # data for plotting
485
+ # New column 'car_name' for plotting (rownames alone are not
486
+ # usable as plot data).
485
487
  mtcars.car_name = R.rownames(:mtcars)
486
488
 
487
- # compute normalized mpg and add it to a new column called mpg_z
488
- # Note that the mean value for mpg can be obtained by calling the 'mean'
489
- # function on the vector 'mtcars.mpg'. The same with the standard
490
- # deviation 'sd'. The vector is then rounded to two digits with 'round 2'
491
- mtcars.mpg_z = ((mtcars.mpg - mtcars.mpg.mean)/mtcars.mpg.sd).round 2
489
+ # Normalized mpg in column mpg_z: (mpg - mean) / sd, rounded.
490
+ mtcars.mpg_z =
491
+ ((mtcars.mpg - mtcars.mpg.mean) / mtcars.mpg.sd).round 2
492
492
 
493
- # create a new column 'mpg_type'. Function 'ifelse' is a vectorized function
494
- # that looks at every element of the mpg_z vector and if the value is below
495
- # 0, returns 'below', otherwise returns 'above'
496
- mtcars.mpg_type = (mtcars.mpg_z < 0).ifelse("below", "above")
493
+ # mpg_type: 'below' if mpg_z < 0, else 'above' (vectorized ifelse).
494
+ mtcars.mpg_type =
495
+ (mtcars.mpg_z < 0).ifelse("below", "above")
497
496
 
498
- # order the mtcar data set by the mpg_z vector from smaler to larger values
497
+ # Order rows by mpg_z ascending.
499
498
  mtcars = mtcars[mtcars.mpg_z.order, :all]
500
499
 
501
- # convert the car_name column to a factor to retain sorted order in plot
502
- mtcars.car_name = mtcars.car_name.factor levels: mtcars.car_name
500
+ # Factor car_name so plot keeps sorted order.
501
+ mtcars.car_name =
502
+ mtcars.car_name.factor levels: mtcars.car_name
503
503
 
504
- # let's look at the first records of the final data frame
504
+ # First records of the final data frame
505
505
  puts mtcars.head
506
506
  ```
507
507
 
508
508
  ```
509
- ## mpg cyl disp hp drat wt qsec vs am gear carb
510
- ## Cadillac Fleetwood 10.4 8 472 205 2.93 5.250 17.98 0 0 3 4
511
- ## Lincoln Continental 10.4 8 460 215 3.00 5.424 17.82 0 0 3 4
512
- ## Camaro Z28 13.3 8 350 245 3.73 3.840 15.41 0 0 3 4
513
- ## Duster 360 14.3 8 360 245 3.21 3.570 15.84 0 0 3 4
514
- ## Chrysler Imperial 14.7 8 440 230 3.23 5.345 17.42 0 0 3 4
515
- ## Maserati Bora 15.0 8 301 335 3.54 3.570 14.60 0 1 5 8
516
- ## car_name mpg_z mpg_type
517
- ## Cadillac Fleetwood Cadillac Fleetwood -1.61 below
518
- ## Lincoln Continental Lincoln Continental -1.61 below
519
- ## Camaro Z28 Camaro Z28 -1.13 below
520
- ## Duster 360 Duster 360 -0.96 below
521
- ## Chrysler Imperial Chrysler Imperial -0.89 below
522
- ## Maserati Bora Maserati Bora -0.84 below
509
+ ## mpg cyl disp hp drat wt qsec vs am gear
510
+ ## Cadillac Fleetwood 10.4 8 472 205 2.93 5.250 17.98 0 0 3
511
+ ## Lincoln Continental 10.4 8 460 215 3.00 5.424 17.82 0 0 3
512
+ ## Camaro Z28 13.3 8 350 245 3.73 3.840 15.41 0 0 3
513
+ ## Duster 360 14.3 8 360 245 3.21 3.570 15.84 0 0 3
514
+ ## Chrysler Imperial 14.7 8 440 230 3.23 5.345 17.42 0 0 3
515
+ ## Maserati Bora 15.0 8 301 335 3.54 3.570 14.60 0 1 5
516
+ ## carb car_name mpg_z mpg_type
517
+ ## Cadillac Fleetwood 4 Cadillac Fleetwood -1.61 below
518
+ ## Lincoln Continental 4 Lincoln Continental -1.61 below
519
+ ## Camaro Z28 4 Camaro Z28 -1.13 below
520
+ ## Duster 360 4 Duster 360 -0.96 below
521
+ ## Chrysler Imperial 4 Chrysler Imperial -0.89 below
522
+ ## Maserati Bora 8 Maserati Bora -0.84 below
523
523
  ```
524
524
 
525
525
 
526
526
  ``` ruby
527
527
  require 'ggplot'
528
528
 
529
- puts mtcars.ggplot(E.aes(x: :car_name, y: :mpg_z, label: :mpg_z)) +
530
- R.geom_bar(E.aes(fill: :mpg_type), stat: 'identity', width: 0.5) +
531
- R.scale_fill_manual(name: 'Mileage',
532
- labels: R.c('Above Average', 'Below Average'),
533
- values: R.c('above': '#00ba38', 'below': '#f8766d')) +
529
+ puts mtcars.ggplot(
530
+ E.aes(x: :car_name, y: :mpg_z, label: :mpg_z)) +
531
+ R.geom_bar(E.aes(fill: :mpg_type),
532
+ stat: 'identity', width: 0.5) +
533
+ R.scale_fill_manual(
534
+ name: 'Mileage',
535
+ labels: R.c('Above Average', 'Below Average'),
536
+ values: R.c('above': '#00ba38',
537
+ 'below': '#f8766d')) +
534
538
  R.labs(subtitle: "Normalised mileage from 'mtcars'",
535
- title: "Diverging Bars") +
539
+ title: "Diverging Bars") +
536
540
  R.coord_flip
537
541
  ```
538
542
 
@@ -548,7 +552,8 @@ with the 'rb' engine. The following chunk specification will
548
552
  create and inline Ruby text:
549
553
 
550
554
  ````
551
- This is some text with inline Ruby accessing variable 'b' which has value:
555
+ This is some text with inline Ruby accessing
556
+ variable 'b' which has value:
552
557
  ```{rb puts b}
553
558
  ```
554
559
  and is followed by some other text!
@@ -1337,7 +1342,7 @@ module Find
1337
1342
  # Skips the current file or directory, restarting the loop with the next
1338
1343
  # entry. If the current file is a directory, that directory will not be
1339
1344
  # recursively entered. Meaningful only within the block associated with
1340
- # Find:R[:find].
1345
+ # Find::find.
1341
1346
  #
1342
1347
  # See the +Find+ module documentation for an example.
1343
1348
  #
@@ -1361,7 +1366,7 @@ the Yaml header to generate this blog in PDF format instead of HTML:
1361
1366
 
1362
1367
  ```
1363
1368
  ---
1364
- title: "gKnit - Ruby and R Knitting with Galaaz (JRuby or CRuby + GNU R)"
1369
+ title: "gKnit - Ruby and R Knitting with Galaaz"
1365
1370
  author: "Rodrigo Botafogo"
1366
1371
  tags: [Galaaz, Ruby, R, JRuby, CRuby, "GNU R", knitr, gknit]
1367
1372
  date: "29 October 2018"