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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -0
- data/Rakefile +20 -2
- data/bin/check_gemfile_lock_version +46 -0
- data/bin/release_bump +26 -0
- data/blogs/README.md +4 -0
- data/blogs/galaaz_2_0/galaaz_2_0.Rmd +385 -0
- data/blogs/galaaz_2_0/galaaz_2_0.md +409 -0
- data/blogs/galaaz_2_0/galaaz_2_0.tex +756 -0
- data/blogs/galaaz_2_0/images/galaaz-header.png +0 -0
- data/blogs/galaaz_2_0/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +76 -58
- data/blogs/galaaz_ggplot/galaaz_ggplot.md +188 -161
- data/blogs/galaaz_ggplot/galaaz_ggplot.tex +185 -117
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/gknit/gknit.Rmd +48 -28
- data/blogs/gknit/gknit.md +60 -43
- data/blogs/gknit/gknit.tex +1409 -0
- data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
- data/blogs/gknit/gknit_files/figure-latex/bubble-1.png +0 -0
- data/blogs/gknit/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/manual/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/manual/manual.Rmd +161 -71
- data/blogs/manual/manual.md +573 -482
- data/blogs/manual/manual.tex +1113 -517
- data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-markdown_github/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-markdown_github/diverging_bar.png +0 -0
- data/blogs/nse_dplyr/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/nse_dplyr/nse_dplyr.Rmd +42 -8
- data/blogs/nse_dplyr/nse_dplyr.md +69 -50
- data/blogs/nse_dplyr/nse_dplyr.tex +1626 -0
- data/blogs/oh_my/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/oh_my/oh_my.Rmd +206 -55
- data/blogs/oh_my/oh_my.md +247 -96
- data/blogs/oh_my/oh_my.tex +2038 -93
- data/blogs/r_on_rails_ledger/images/00_portfolio_page.png +0 -0
- data/blogs/r_on_rails_ledger/images/01_results_panel.png +0 -0
- data/blogs/r_on_rails_ledger/images/02_density_tail_risk.png +0 -0
- data/blogs/r_on_rails_ledger/images/03_mc_cone.png +0 -0
- data/blogs/r_on_rails_ledger/images/04_rolling_var.png +0 -0
- data/blogs/r_on_rails_ledger/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.Rmd +354 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.md +365 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.tex +670 -0
- data/blogs/ruby_plot/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/ruby_plot/ruby_plot.Rmd +56 -35
- data/blogs/ruby_plot/ruby_plot.md +63 -47
- data/blogs/ruby_plot/ruby_plot.tex +194 -125
- data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/lib/galaaz/cli.rb +98 -13
- data/logos/icon-font/README.md +27 -0
- data/logos/icon-font/build_font.py +130 -0
- data/logos/icon-font/galaaz-mark.svg +34 -0
- data/script/omarchy/README.md +9 -2
- data/script/omarchy/fonts/galaaz.ttf +0 -0
- data/script/omarchy/galaaz-guide.sh +1 -1
- data/script/omarchy/install-galaaz.sh +8 -1
- data/script/omarchy/omarchy-menu.jsonc +21 -9
- data/sty/galaaz-header.png +0 -0
- data/sty/galaaz-headers-from-p3.tex +4 -0
- data/sty/galaaz.sty +76 -23
- data/version.rb +1 -1
- metadata +46 -7
- data/blogs/galaaz_ggplot/galaaz_ggplot.log +0 -754
- data/blogs/manual/manual.log +0 -1786
- data/blogs/nse_dplyr/nse_dplyr.log +0 -928
- data/blogs/oh_my/oh_my.log +0 -804
- data/blogs/ruby_plot/ruby_plot.log +0 -885
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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:
|
|
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
|
-
|
|
211
|
-
|
|
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
|
-
#
|
|
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
|
-
|
|
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(
|
|
798
|
-
|
|
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(
|
|
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:
|
|
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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
##
|
|
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:
|
|
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
|
|
519
|
-
## <int> <int> <int> <int> <int> <dbl> <int>
|
|
520
|
-
## 1 2013 1 1 517 515 2 830
|
|
521
|
-
## 2 2013 1 1 533 529 4 850
|
|
522
|
-
## 3 2013 1 1 542 540 2 923
|
|
523
|
-
## 4 2013 1 1 544 545 -1 1004
|
|
524
|
-
## 5 2013 1 1 554 600 -6 812
|
|
525
|
-
## 6 2013 1 1 554 558 -4 740
|
|
526
|
-
## 7 2013 1 1 555 600 -5 913
|
|
527
|
-
## 8 2013 1 1 557 600 -3 709
|
|
528
|
-
## 9 2013 1 1 557 600 -3 838
|
|
529
|
-
## 10 2013 1 1 558 600 -2 753
|
|
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
|
-
## # ℹ
|
|
532
|
-
## #
|
|
533
|
-
## #
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
|
1050
|
-
## <chr>
|
|
1051
|
-
## 1 Luke
|
|
1052
|
-
## 2 C-3PO
|
|
1053
|
-
## 3 R2-D2
|
|
1054
|
-
## 4 Darth
|
|
1055
|
-
## 5 Leia
|
|
1056
|
-
## 6 Owen
|
|
1057
|
-
## # ℹ
|
|
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
|
|
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(
|
|
1122
|
-
|
|
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(
|
|
1141
|
+
puts grouped_mean(
|
|
1142
|
+
(~R[:starwars]),
|
|
1143
|
+
"eye_color",
|
|
1144
|
+
E.c("mass", "birth_year"))
|
|
1126
1145
|
```
|
|
1127
1146
|
|
|
1128
1147
|
```
|