galaaz 0.4.10 → 2.0.0

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 (391) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/LICENSE +0 -0
  4. data/README.md +3123 -882
  5. data/Rakefile +62 -41
  6. data/bin/galaaz-bootstrap +137 -0
  7. data/bin/galaaz-jruby +14 -0
  8. data/bin/galaaz_jruby_env.inc.sh +6 -0
  9. data/bin/gbookdown +64 -0
  10. data/bin/gknit +223 -6
  11. data/bin/gknit-draft +105 -0
  12. data/bin/gknit-draft.rb +28 -0
  13. data/bin/gknit_Rscript +127 -0
  14. data/bin/grun +27 -1
  15. data/bin/gstudio +49 -4
  16. data/bin/{gstudio.rb → gstudio_irb.rb} +0 -0
  17. data/bin/gstudio_pry.rb +7 -0
  18. data/bin/install-tinytex +6 -0
  19. data/bin/run_all_rspec +43 -0
  20. data/bin/run_example +14 -0
  21. data/bin/run_old_rspec +19 -0
  22. data/bin/run_rspec +23 -0
  23. data/bin/run_rspec_subset +38 -0
  24. data/bin/run_slow_rspec +19 -0
  25. data/blogs/R-on-Rails-Planning-Document.md +940 -0
  26. data/blogs/README.md +100 -0
  27. data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +38 -66
  28. data/blogs/galaaz_ggplot/galaaz_ggplot.log +754 -0
  29. data/blogs/galaaz_ggplot/galaaz_ggplot.md +364 -0
  30. data/blogs/galaaz_ggplot/galaaz_ggplot.tex +607 -0
  31. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
  32. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
  33. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
  34. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
  35. data/blogs/galaaz_ggplot/midwest.Rmd +3 -3
  36. data/blogs/galaaz_ggplot/midwest_external_png +0 -0
  37. data/blogs/gknit/gknit.Rmd +52 -55
  38. data/blogs/gknit/gknit.md +94 -94
  39. data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
  40. data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
  41. data/blogs/gknit/lst.rds +0 -0
  42. data/blogs/gknit/model.rb +1 -1
  43. data/blogs/gknit/stats.bib +0 -0
  44. data/blogs/manual/include_model_local_repro.Rmd +14 -0
  45. data/blogs/manual/include_model_local_repro.md +75 -0
  46. data/blogs/manual/lst.rds +0 -0
  47. data/blogs/manual/manual.Rmd +1582 -196
  48. data/blogs/manual/manual.log +1786 -0
  49. data/blogs/manual/manual.md +3107 -890
  50. data/blogs/manual/manual.tex +3018 -1086
  51. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  52. data/blogs/manual/manual_files/figure-html/diverging_bar.png +0 -0
  53. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  54. data/blogs/manual/model.rb +41 -0
  55. data/blogs/nse_dplyr/nse_dplyr.Rmd +277 -151
  56. data/blogs/nse_dplyr/nse_dplyr.log +928 -0
  57. data/blogs/nse_dplyr/nse_dplyr.md +457 -293
  58. data/blogs/oh_my/not_so.rb +0 -0
  59. data/blogs/oh_my/oh_my.Rmd +1234 -25
  60. data/blogs/oh_my/oh_my.log +804 -0
  61. data/blogs/oh_my/oh_my.md +1808 -228
  62. data/blogs/oh_my/oh_my.tex +821 -0
  63. data/blogs/oh_my/old.Rmd +15 -14
  64. data/blogs/ruby_plot/ruby_plot.Rmd +58 -82
  65. data/blogs/ruby_plot/ruby_plot.log +885 -0
  66. data/blogs/ruby_plot/ruby_plot.md +71 -103
  67. data/blogs/ruby_plot/ruby_plot.tex +940 -0
  68. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
  69. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
  70. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
  71. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
  72. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
  73. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
  74. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  75. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
  76. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
  77. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  78. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  79. data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
  80. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  81. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  82. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  83. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  84. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  85. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  86. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  87. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  88. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  89. data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  90. data/blogs/test/test.Rmd +14 -0
  91. data/examples/50Plots_MasterList/Images/midwest-scatterplot.PNG +0 -0
  92. data/examples/50Plots_MasterList/ScatterPlot.rb +0 -0
  93. data/examples/50Plots_MasterList/scatter_plot.rb +0 -0
  94. data/examples/Bibliography/master.bib +50 -0
  95. data/examples/Bibliography/stats.bib +72 -0
  96. data/examples/R/calc.R +0 -0
  97. data/examples/R/java_interop.R +0 -0
  98. data/examples/bioconductor_deseq2_airway/Documentation/DESeq2-airway-walkthrough.md +56 -0
  99. data/examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb +53 -0
  100. data/examples/bioconductor_deseq2_airway/bench_r_three_same_process.R +34 -0
  101. data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb +33 -0
  102. data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz_optimized.rb +34 -0
  103. data/examples/bioconductor_deseq2_airway/deseq2_airway_minimal.R +30 -0
  104. data/examples/bioconductor_deseq2_airway/deseq2_airway_pipeline_for_bench.R +36 -0
  105. data/examples/islr/all.rb +13 -0
  106. data/examples/islr/ch2.spec.rb +37 -7
  107. data/examples/islr/ch3.spec.rb +11 -2
  108. data/examples/islr/ch3_boston.rb +27 -0
  109. data/examples/islr/ch3_multiple_regression.rb +0 -0
  110. data/examples/islr/ch6.spec.rb +24 -1
  111. data/examples/islr/x_y_rnorm.jpg +0 -0
  112. data/examples/latex_templates/Test-acm_article/Makefile +16 -0
  113. data/examples/latex_templates/Test-acm_article/Test-acm_article.Rmd +65 -0
  114. data/examples/latex_templates/Test-acm_article/acm_proc_article-sp.cls +1670 -0
  115. data/examples/latex_templates/Test-acm_article/sensys-abstract.cls +703 -0
  116. data/examples/latex_templates/Test-acm_article/sigproc.bib +59 -0
  117. data/examples/latex_templates/Test-acs_article/Test-acs_article.Rmd +260 -0
  118. data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +11 -0
  119. data/examples/latex_templates/Test-acs_article/acs-my_output.bib +11 -0
  120. data/examples/latex_templates/Test-acs_article/acstest.bib +17 -0
  121. data/examples/latex_templates/Test-aea_article/AEA.cls +1414 -0
  122. data/{blogs/gknit/marshal.dump → examples/latex_templates/Test-aea_article/BibFile.bib} +0 -0
  123. data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +108 -0
  124. data/examples/latex_templates/Test-aea_article/aea.bst +1269 -0
  125. data/examples/latex_templates/Test-aea_article/multicol.sty +853 -0
  126. data/examples/latex_templates/Test-aea_article/references.bib +0 -0
  127. data/examples/latex_templates/Test-aea_article/setspace.sty +546 -0
  128. data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +256 -0
  129. data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +3397 -0
  130. data/examples/latex_templates/Test-ams_article/Test-ams_article.Rmd +215 -0
  131. data/examples/latex_templates/Test-ams_article/amstest.bib +436 -0
  132. data/examples/latex_templates/Test-asa_article/Test-asa_article.Rmd +153 -0
  133. data/examples/latex_templates/Test-asa_article/agsm.bst +1353 -0
  134. data/examples/latex_templates/Test-asa_article/bibliography.bib +233 -0
  135. data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +2409 -0
  136. data/examples/latex_templates/Test-ieee_article/IEEEtran.cls +6346 -0
  137. data/examples/latex_templates/Test-ieee_article/Test-ieee_article.Rmd +175 -0
  138. data/examples/latex_templates/Test-ieee_article/mybibfile.bib +20 -0
  139. data/examples/latex_templates/Test-rjournal_article/RJournal.sty +335 -0
  140. data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +18 -0
  141. data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +52 -0
  142. data/examples/latex_templates/Test-springer_article/Test-springer_article.Rmd +65 -0
  143. data/examples/latex_templates/Test-springer_article/bibliography.bib +26 -0
  144. data/examples/latex_templates/Test-springer_article/spbasic.bst +1658 -0
  145. data/examples/latex_templates/Test-springer_article/spmpsci.bst +1512 -0
  146. data/examples/latex_templates/Test-springer_article/spphys.bst +1443 -0
  147. data/examples/latex_templates/Test-springer_article/svglov3.clo +113 -0
  148. data/examples/latex_templates/Test-springer_article/svjour3.cls +1431 -0
  149. data/examples/misc/baseball.csv +0 -0
  150. data/examples/misc/ggplot.rb +3 -2
  151. data/examples/misc/moneyball.rb +0 -0
  152. data/examples/misc/subsetting.rb +0 -0
  153. data/examples/multithread_shards_to_r/shards_to_r.rb +67 -0
  154. data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.Rmd +73 -0
  155. data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +382 -0
  156. data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +164 -0
  157. data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +92 -0
  158. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +482 -0
  159. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +280 -0
  160. data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +386 -0
  161. data/examples/sthda_ggplot/README.md +0 -0
  162. data/examples/sthda_ggplot/RUN.md +41 -0
  163. data/examples/sthda_ggplot/all.rb +0 -0
  164. data/examples/sthda_ggplot/one_variable_continuous/density_gg.rb +0 -0
  165. data/examples/sthda_ggplot/one_variable_continuous/geom_area.rb +0 -0
  166. data/examples/sthda_ggplot/one_variable_continuous/geom_density.rb +2 -0
  167. data/examples/sthda_ggplot/one_variable_continuous/geom_dotplot.rb +0 -0
  168. data/examples/sthda_ggplot/one_variable_continuous/geom_freqpoly.rb +0 -0
  169. data/examples/sthda_ggplot/one_variable_continuous/geom_histogram.rb +0 -0
  170. data/examples/sthda_ggplot/one_variable_continuous/histogram_density.rb +0 -0
  171. data/examples/sthda_ggplot/one_variable_continuous/stat.rb +0 -0
  172. data/examples/sthda_ggplot/one_variable_discrete/bar.rb +0 -0
  173. data/examples/sthda_ggplot/qplots/box_violin_dot.rb +0 -0
  174. data/examples/sthda_ggplot/qplots/scatter_plots.rb +0 -0
  175. data/examples/sthda_ggplot/scatter_gg.rb +0 -0
  176. data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_bin2d.rb +0 -0
  177. data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_density2d.rb +0 -0
  178. data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_hex.rb +0 -0
  179. data/examples/sthda_ggplot/two_variables_cont_cont/geom_point.rb +0 -0
  180. data/examples/sthda_ggplot/two_variables_cont_cont/geom_smooth.rb +0 -0
  181. data/examples/sthda_ggplot/two_variables_cont_cont/misc.rb +0 -0
  182. data/examples/sthda_ggplot/two_variables_cont_function/geom_area.rb +4 -3
  183. data/examples/sthda_ggplot/two_variables_disc_cont/geom_bar.rb +0 -0
  184. data/examples/sthda_ggplot/two_variables_disc_cont/geom_boxplot.rb +0 -0
  185. data/examples/sthda_ggplot/two_variables_disc_cont/geom_dotplot.rb +0 -0
  186. data/examples/sthda_ggplot/two_variables_disc_cont/geom_jitter.rb +0 -0
  187. data/examples/sthda_ggplot/two_variables_disc_cont/geom_line.rb +0 -0
  188. data/examples/sthda_ggplot/two_variables_disc_cont/geom_violin.rb +0 -0
  189. data/examples/sthda_ggplot/two_variables_disc_disc/geom_jitter.rb +0 -0
  190. data/examples/sthda_ggplot/two_variables_error/geom_crossbar.rb +0 -0
  191. data/ext/new_bridge/Makefile +46 -0
  192. data/ext/new_bridge/galaaz_gatekeeper_phase0.cpp +12 -0
  193. data/ext/new_bridge/galaaz_gatekeeper_phase1.cpp +1639 -0
  194. data/lib/R_interface/galaaz_device.R +20 -0
  195. data/lib/R_interface/include_engine.R +109 -0
  196. data/lib/R_interface/new_bridge_adapter.rb +824 -0
  197. data/lib/R_interface/r.rb +177 -25
  198. data/lib/R_interface/r_arrow.rb +113 -0
  199. data/lib/R_interface/r_libs.R +4 -4
  200. data/lib/R_interface/r_methods.rb +13 -116
  201. data/lib/R_interface/r_module_s.rb +0 -0
  202. data/lib/R_interface/rbinary_operators.rb +20 -2
  203. data/lib/R_interface/rclosure.rb +5 -1
  204. data/lib/R_interface/rdata_frame.rb +34 -70
  205. data/lib/R_interface/rdevice.rb +125 -0
  206. data/lib/R_interface/rdevices.R +0 -0
  207. data/lib/R_interface/renvironment.rb +10 -4
  208. data/lib/R_interface/rexpression.rb +5 -1
  209. data/lib/R_interface/rindexed_object.rb +41 -13
  210. data/lib/R_interface/rlanguage.rb +20 -62
  211. data/lib/R_interface/rlist.rb +115 -25
  212. data/lib/R_interface/rlogical_operators.rb +0 -0
  213. data/lib/R_interface/rmatrix.rb +2 -11
  214. data/lib/R_interface/rmd_indexed_object.rb +5 -1
  215. data/lib/R_interface/robject.rb +348 -290
  216. data/lib/R_interface/rpkg.rb +1 -0
  217. data/lib/R_interface/rsupport.rb +610 -331
  218. data/lib/R_interface/rsupport_scope.rb +2 -1
  219. data/lib/R_interface/rsymbol.rb +50 -0
  220. data/lib/R_interface/ruby_callback.rb +2 -3
  221. data/lib/R_interface/ruby_extensions.rb +225 -175
  222. data/lib/R_interface/runary_operators.rb +0 -0
  223. data/lib/R_interface/rvector.rb +147 -31
  224. data/lib/galaaz.rb +0 -0
  225. data/lib/galaaz_jruby.rb +22 -0
  226. data/lib/gknit/diagnostics.rb +50 -0
  227. data/lib/gknit/draft.rb +111 -0
  228. data/lib/gknit/include_engine.rb +15 -7
  229. data/lib/gknit/knitr_engine.rb +223 -107
  230. data/lib/gknit/rb_engine.rb +3 -3
  231. data/lib/gknit/ruby_engine.rb +0 -0
  232. data/lib/gknit.rb +3 -0
  233. data/lib/new_bridge/bootstrap/windows_bootstrap.rb +285 -0
  234. data/lib/new_bridge/envelope.rb +51 -0
  235. data/lib/new_bridge/eval_result.rb +26 -0
  236. data/lib/new_bridge/framing.rb +39 -0
  237. data/lib/new_bridge/instance_pool_client.rb +38 -0
  238. data/lib/new_bridge/r_instance_manager.rb +404 -0
  239. data/lib/new_bridge/session_client.rb +530 -0
  240. data/lib/new_bridge/tcp_framed.rb +44 -0
  241. data/lib/new_bridge.rb +9 -0
  242. data/lib/util/exec_ruby.rb +95 -46
  243. data/lib/util/inline_file.rb +35 -30
  244. data/new_bridge_specs/benchmark_phase5_5_unboxing_spec.rb +96 -0
  245. data/new_bridge_specs/eval_r_async_spec.rb +113 -0
  246. data/new_bridge_specs/integration_phase5_1_concurrent_spec.rb +50 -0
  247. data/new_bridge_specs/integration_phase5_1_eval_spec.rb +16 -0
  248. data/new_bridge_specs/integration_phase5_1_r_api_spec.rb +25 -0
  249. data/new_bridge_specs/integration_phase5_1_smoke_spec.rb +31 -0
  250. data/new_bridge_specs/integration_phase5_2_dataframe_unboxing_spec.rb +19 -0
  251. data/new_bridge_specs/integration_phase5_2_handle_eval_unboxing_spec.rb +25 -0
  252. data/new_bridge_specs/integration_phase5_3_callback_args_spec.rb +28 -0
  253. data/new_bridge_specs/integration_phase5_3_callback_error_spec.rb +22 -0
  254. data/new_bridge_specs/integration_phase5_3_callback_timeout_spec.rb +28 -0
  255. data/new_bridge_specs/integration_phase5_3_callbacks_smoke_spec.rb +22 -0
  256. data/new_bridge_specs/integration_phase5_3_edge_cases_spec.rb +52 -0
  257. data/new_bridge_specs/integration_phase5_3_nested_spec.rb +30 -0
  258. data/new_bridge_specs/integration_phase5_4_concurrent_sessions_spec.rb +53 -0
  259. data/new_bridge_specs/integration_phase5_4_nested_session_callbacks_spec.rb +49 -0
  260. data/new_bridge_specs/integration_phase5_4_session_routing_spec.rb +38 -0
  261. data/new_bridge_specs/integration_phase5_5_stress_concurrency_spec.rb +52 -0
  262. data/new_bridge_specs/integration_phase5_5_unbox_walk_spec.rb +46 -0
  263. data/new_bridge_specs/phase0_protocol_spec.rb +96 -0
  264. data/new_bridge_specs/phase1_req_ret_spec.rb +66 -0
  265. data/new_bridge_specs/phase2_multi_instance_spec.rb +67 -0
  266. data/new_bridge_specs/phase3_callbacks_spec.rb +71 -0
  267. data/new_bridge_specs/phase4_2_hardening_spec.rb +252 -0
  268. data/new_bridge_specs/phase4_3_r_instance_manager_spec.rb +85 -0
  269. data/new_bridge_specs/phase4_nested_callbacks_spec.rb +123 -0
  270. data/r_requires/ggplot.rb +0 -0
  271. data/r_requires/knitr.rb +0 -0
  272. data/specs/all.rb +15 -11
  273. data/specs/arrow_from_ruby_batches_spec.rb +50 -0
  274. data/specs/arrow_semantics_spec.rb +64 -0
  275. data/specs/bridge_concurrent_spec.rb +46 -0
  276. data/specs/bridge_nested_spec.rb +25 -0
  277. data/specs/dataframe_semantics_spec.rb +122 -0
  278. data/specs/dataframe_single_index_logical_filter_spec.rb +21 -0
  279. data/specs/dispatch_probe_cache_spec.rb +38 -0
  280. data/specs/dispatch_probe_error_class_fallback_spec.rb +20 -0
  281. data/specs/dispatch_probe_fallback_spec.rb +18 -0
  282. data/specs/environment_semantics_spec.rb +89 -0
  283. data/specs/field_access_spec.rb +31 -0
  284. data/specs/figures/bg.jpeg +0 -0
  285. data/specs/figures/bg.png +0 -0
  286. data/specs/figures/bg.svg +168 -57
  287. data/specs/figures/dose_len.png +0 -0
  288. data/specs/figures/no_args.jpeg +0 -0
  289. data/specs/figures/no_args.png +0 -0
  290. data/specs/figures/no_args.svg +168 -57
  291. data/specs/figures/width_height.jpeg +0 -0
  292. data/specs/figures/width_height.png +0 -0
  293. data/specs/figures/width_height_units1.jpeg +0 -0
  294. data/specs/figures/width_height_units1.png +0 -0
  295. data/specs/figures/width_height_units2.jpeg +0 -0
  296. data/specs/figures/width_height_units2.png +0 -0
  297. data/specs/formula_semantics_spec.rb +81 -0
  298. data/specs/galaaz_util_exec_ruby_spec.rb +85 -0
  299. data/specs/galaaz_util_inline_file_spec.rb +54 -0
  300. data/specs/gknit_cli_option_permutation_spec.rb +24 -0
  301. data/specs/gknit_include_engine_spec.rb +72 -0
  302. data/specs/gknit_install_timeout_report_spec.rb +69 -0
  303. data/specs/gknit_internal_error_report_spec.rb +57 -0
  304. data/specs/gknit_vector_map_output_spec.rb +59 -0
  305. data/specs/globalenv_guardrail_spec.rb +52 -0
  306. data/specs/language_expression_semantics_spec.rb +145 -0
  307. data/specs/list_semantics_spec.rb +111 -0
  308. data/specs/new_bridge_bulk_dataframe_transfer_spec.rb +44 -0
  309. data/specs/new_bridge_bulk_vector_transfer_spec.rb +73 -0
  310. data/specs/new_bridge_callback_timeout_spec.rb +69 -0
  311. data/specs/new_bridge_eval_r_fallback_spec.rb +55 -0
  312. data/specs/nil_null_spec.rb +42 -0
  313. data/specs/object_build_phase2_spec.rb +53 -0
  314. data/specs/phase1_callback_bridge_spec.rb +84 -0
  315. data/specs/phase2_gknit_generic_rendering_guardrail_spec.rb +46 -0
  316. data/specs/phase2_gknit_no_raw_code_leakage_spec.rb +43 -0
  317. data/specs/phase3_gknit_generic_graphics_capture_spec.rb +71 -0
  318. data/specs/plot_device_semantics_spec.rb +28 -0
  319. data/specs/plot_snapshot_semantics_spec.rb +58 -0
  320. data/specs/protocol_result_spec.rb +236 -0
  321. data/specs/r_batch_fail_fast_spec.rb +47 -0
  322. data/specs/r_bridge_bootstrap_spec.rb +11 -0
  323. data/specs/r_devices.spec.rb +1 -1
  324. data/specs/r_eval.spec.rb +16 -18
  325. data/specs/r_function.spec.rb +1 -1
  326. data/specs/r_instance_manager_spec.rb +285 -0
  327. data/specs/r_list_apply.spec.rb +15 -15
  328. data/specs/r_matrix.spec.rb +0 -0
  329. data/specs/r_nse.spec.rb +5 -5
  330. data/specs/r_object_send_dispatch_spec.rb +13 -0
  331. data/specs/r_vector_comparator_spec.rb +8 -0
  332. data/specs/r_vector_creation.spec.rb +0 -0
  333. data/specs/r_vector_functions.spec.rb +0 -0
  334. data/specs/r_vector_object.spec.rb +0 -0
  335. data/specs/r_vector_operators.spec.rb +0 -0
  336. data/specs/r_vector_structured_scalar_reads_spec.rb +35 -0
  337. data/specs/r_vector_subsetting.spec.rb +0 -0
  338. data/specs/range_helper_spec.rb +21 -0
  339. data/specs/rsupport_scope_spec.rb +28 -0
  340. data/specs/rsupport_var_name_thread_safety_spec.rb +24 -0
  341. data/specs/scalar_character_spec.rb +44 -0
  342. data/specs/scoped_symbol_dsl_refinement_spec.rb +40 -0
  343. data/specs/session_env_bridge_spec.rb +25 -0
  344. data/specs/simplecov_bootstrap_spec.rb +10 -0
  345. data/specs/spec_helper.rb +10 -0
  346. data/specs/tmp.rb +41 -20
  347. data/specs/unboxing_recursion_regression_spec.rb +30 -0
  348. data/specs/unboxing_spec.rb +49 -0
  349. data/specs/verify_callbacks.rb +42 -0
  350. data/sty/galaaz.sty +0 -0
  351. data/version.rb +1 -1
  352. metadata +239 -71
  353. data/blogs/galaaz_ggplot/galaaz_ggplot.aux +0 -41
  354. data/blogs/galaaz_ggplot/galaaz_ggplot.html +0 -705
  355. data/blogs/galaaz_ggplot/galaaz_ggplot.out +0 -10
  356. data/blogs/galaaz_ggplot/galaaz_ggplot.pdf +0 -0
  357. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/midwest_rb.pdf +0 -0
  358. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/scatter_plot_rb.pdf +0 -0
  359. data/blogs/galaaz_ggplot/midwest.html +0 -188
  360. data/blogs/gknit/gknit.html +0 -2266
  361. data/blogs/gknit/gknit.pdf +0 -0
  362. data/blogs/gknit/gknit.tex +0 -1358
  363. data/blogs/manual/graph.rb +0 -29
  364. data/blogs/manual/manual.html +0 -2995
  365. data/blogs/manual/manual.pdf +0 -0
  366. data/blogs/manual/manual_files/figure-latex/diverging_bar.pdf +0 -0
  367. data/blogs/nse_dplyr/nse_dplyr.html +0 -960
  368. data/blogs/nse_dplyr/nse_dplyr.pdf +0 -0
  369. data/blogs/nse_dplyr/nse_dplyr.tex +0 -1373
  370. data/blogs/oh_my/oh_my.html +0 -680
  371. data/blogs/ruby_plot/ruby_plot.Rmd_external_figs +0 -662
  372. data/blogs/ruby_plot/ruby_plot.html +0 -729
  373. data/blogs/ruby_plot/ruby_plot.pdf +0 -0
  374. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.svg +0 -57
  375. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.svg +0 -106
  376. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.svg +0 -110
  377. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.svg +0 -174
  378. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.svg +0 -236
  379. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.svg +0 -296
  380. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.svg +0 -236
  381. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.svg +0 -218
  382. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.svg +0 -128
  383. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.svg +0 -150
  384. data/examples/paper/paper.rb +0 -36
  385. data/specs/r_dataframe.spec.rb +0 -379
  386. data/specs/r_environment.spec.rb +0 -140
  387. data/specs/r_formula.spec.rb +0 -232
  388. data/specs/r_language.spec.rb +0 -112
  389. data/specs/r_list.spec.rb +0 -293
  390. data/specs/r_plots.spec.rb +0 -72
  391. data/specs/ruby_expression.spec.rb +0 -315
@@ -0,0 +1,280 @@
1
+ ---
2
+ output:
3
+ pdf_document:
4
+ keep_tex: true
5
+ fig_caption: yes
6
+ latex_engine: pdflatex
7
+ template: /home/rbotafogo/desenv/galaaz/sty/svm-r-markdown-templates/svm-latex-syllabus.tex
8
+ geometry: margin=1in
9
+
10
+ title: "POSC 0000: A Class with an R Markdown Syllabus"
11
+ author: Steven V. Miller
12
+ date: "Fall 2016"
13
+
14
+ email: "svmille@clemson.edu"
15
+ web: "svmiller.com/teaching"
16
+ officehours: "W 09:00-11:30 a.m."
17
+ office: "230A Brackett Hall"
18
+ classroom: "*online*"
19
+ classhours: "TR 02:00-03:45 p.m."
20
+
21
+ fontfamily: mathpazo
22
+ fontsize: 11pt
23
+ header-includes:
24
+ - \linespread{1.05}
25
+ ---
26
+
27
+ ```{ruby install, echo=FALSE}
28
+ R.install_and_loads 'RefManageR'
29
+ R.install_and_loads 'kfigr'
30
+ ```
31
+
32
+ ```{r setup, include=FALSE}
33
+ knitr::opts_chunk$set(cache=FALSE, dev='pdf')
34
+ mon <- as.Date("2016-08-15")
35
+ # fri <- as.Date("2016-01-08")
36
+
37
+ advdate <- function(obj, adv) {
38
+ tmon <- obj + 7*(adv-1)
39
+ tfri <- obj + 4 + 7*(adv-1)
40
+ tmon <- format(tmon, format="%m/%d")
41
+ tfri <- format(tfri, format="%m/%d")
42
+ zadv <- sprintf("%02d", adv)
43
+ tmp <- paste("Week ",zadv,sep='',", ", tmon," - ",tfri)
44
+ return(tmp)
45
+ }
46
+
47
+ library(RefManageR)
48
+ # library(knitcitations)
49
+ # library(rcrossref)
50
+ bib <- ReadBib("/home/rbotafogo/desenv/galaaz/examples/Bibliography/master.bib")
51
+ myopts <- BibOptions(bib.style = "authoryear", style="latex", first.inits=FALSE, max.names = 20)
52
+ ```
53
+
54
+ # Course Description
55
+
56
+ You'll learn stuff in this class, I hope. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
57
+ Maecenas scelerisque elit sapien, eu consequat dui blandit in. Vestibulum dignissim feugiat
58
+ mauris, at pretium turpis blandit nec. Aliquam porta scelerisque tortor, eget imperdiet quam
59
+ dapibus et. Sed ut sollicitudin orci, id elementum arcu. Sed arcu quam, vestibulum molestie
60
+ mattis sed, ultricies sed est. Phasellus eu nunc et urna volutpat pharetra. Donec interdum ante
61
+ vitae odio malesuada blandit. Fusce at condimentum libero, eu elementum arcu. Aenean posuere
62
+ id lorem in varius. Sed bibendum neque pretium dolor faucibus, in cursus ipsum suscipit.
63
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam erat volutpat. Phasellus
64
+ mollis egestas risus, non maximus nisl euismod sit amet. Vestibulum laoreet et urna vitae
65
+ rutrum. Donec quis dui elit.
66
+
67
+ # Course Objectives
68
+
69
+ 1. You'll learn this
70
+
71
+ 2. And also that
72
+
73
+ 3. Perhaps some of this too.
74
+
75
+ # Required Readings
76
+
77
+ ```{r, echo = FALSE, results="asis"}
78
+ # bib["vasquez2009twp", "wagner2007ws"]
79
+ ```
80
+
81
+
82
+ # Course Policy
83
+
84
+ I will detail the policy for this course below. Basically, don't cheat and try to learn
85
+ stuff. Don't be that guy.
86
+
87
+ ## Grading Policy
88
+
89
+ - **20%** of your grade will be determined by a midterm during normal class hours.
90
+
91
+ - **20%** of your grade will be determined by a term paper that documents your appreciation
92
+ of Foghat's "Slow Ride", the most important song ever written. "Slow Ride" is what Mozart
93
+ wishes *Don Giovanni* could have been.
94
+
95
+ - **10%** of your grade will be determined by your attendance and participation in class.
96
+ Generally, ask questions and answer them.
97
+
98
+ - **20%** of your grade will be determined by a 20-page term paper on when exactly
99
+ "The Love Boat" jumped the proverbial shark. You will address whether this shark-jumping
100
+ can be attributed to Ted McGinley, the introduction of Jill Whelan as "Vicki", or some
101
+ other cause.
102
+
103
+ - **30%** of your grade will be determined by a final exam.
104
+
105
+ ## Attendance Policy
106
+
107
+ ```{r, include=FALSE}
108
+ options(scipen=999)
109
+ Attend <- read.csv("attend-grade-relationships.csv")
110
+ M1 <- lm(rgrade ~ perattend, Attend)
111
+ M2 <- lm(rgrade ~ perattend, data=subset(Attend, perattend >= 75))
112
+ library(broom)
113
+
114
+ M1df <- tidy(M1)
115
+ M2df <- tidy(M2)
116
+ library(ggplot2)
117
+ library(kfigr)
118
+ ```
119
+
120
+ > *Showing up is 80 percent of life* -- Woody Allen, [via Marshall Brickman](http://quoteinvestigator.com/2013/06/10/showing-up/#note-6553-1)
121
+
122
+ Students should be weary of skipping class. I deduct *all* participation points for a class
123
+ after five unexcused absences and this can have important implications for a student's
124
+ overall grade in the class. There is already a strong positive correlation between the
125
+ percentage of classes a student has attended in the course and the student's final grade for
126
+ the semester (*r* = `r round(cor(Attend$perattend, Attend$rgrade, use="complete.obs"), 3)`) for
127
+ all `r nrow(Attend)` students I have taught since Fall 2014.
128
+
129
+ A simple linear regression of a student's final grade on percentage of classes attended for
130
+ the semester for all classes I have taught since Fall 2014 suggests an increase of one percent
131
+ in attendance for the semester leads to an estimated increase of `r round(M1$coefficients[2], 3)`
132
+ in the student's final grade. Whereas one missed classes constitutes about a five-percent
133
+ decrease in percentage attendance for the semester, one missed class means an estimated
134
+ decrease of `r round(M1$coefficients[2], 3)*5` in the overall grade. The effect of attendance
135
+ on the final grade for the class is precise (*t* = `r round(M1df$statistic[2], 3)`) and the
136
+ likelihood that there is no actual relationship between attendance and final grade for the
137
+ semester is almost zero. This simple linear model with just one predictor (attendance) provides
138
+ a good fit as well (R$^2$ = `r round(summary(M1)$r.squared, 3)`). See
139
+ `r figr("attendplot", TRUE, type="Figure")` in this document.
140
+
141
+ ```{r attendplot, dev = "png", echo = FALSE, results="asis", cache=FALSE, fig.cap="A Scatterplot of the Relationship between Class Attendance and Final Grade", fig.height=4, fig.pos="H"}
142
+ Graph <- ggplot(Attend, aes(x = perattend, y = rgrade))
143
+ Graph + geom_point() + labs(x="Percent Attendance in Class", y="Final Grade in Class (0-100)") +
144
+ geom_smooth(method=lm)
145
+ ```
146
+
147
+ A student might object that attendance is partly endogenous to a grade since past classes deducted
148
+ all participation points after five unexcused absences. This is true, but the findings
149
+ hold even when I subset the data to cases where attendance is greater than 75% (i.e.
150
+ roughly the threshold below which I deduct all participation points). Students who just meet
151
+ the threshold for full participation points nevertheless get an estimated decrease of
152
+ `r round(M2$coefficients[2], 3)*5` in their overall grade for each missed class. This effect
153
+ is also precise (*t* = `r round(M2df$statistic[2], 3)`). Put another way, we would have
154
+ observed this effect in my data if there were no *true* effect of attendance on grades
155
+ about `r round(summary(M2)$coefficients[2,4]*100000)` times in 100,000 "trials"
156
+ (i.e. *p* = `r round(summary(M2)$coefficients[2,4], 5)`), on average. That probability is
157
+ effectively zero. *Attend class*.
158
+
159
+ ## Late Arrival of the Professor Policy
160
+
161
+ My current university, from what I have been told, asks professors to have policies written
162
+ into their syllabus about what students should do if the professor is more than 15 minutes
163
+ late to class. This seems like an anachronism. I will inform students via e-mail in advance
164
+ of class if class is cancelled for the day. I will also contact our department secretary if
165
+ something happened on the way to work. Failing that, assume the worst happened to me. I ask
166
+ the students make sure that my story gets the proper treatment on an *Investigation
167
+ Discovery* show. I also ask that my story be narrated by Keith Morrison.
168
+
169
+ ## E-mail Policy
170
+
171
+ I am usually quick to respond to student e-mails. However, student e-mails tend to do several
172
+ things that try my patience. I have a new policy, effective Fall 2016, that outlines why I
173
+ will not respond to certain e-mails students send. Multiple rationales follow.
174
+
175
+ 1. The student could answer his/her own inquiry by reading the syllabus.
176
+ 2. The student missed class for which there was no exam. I do not need to know the exact
177
+ reason for a missed class. Students with excusable absences are responsible for giving me
178
+ a note *in hard copy* that documents the reason for the missed class. An e-mail is
179
+ unnecessary unless the impromptu absence involved missing a midterm or final.
180
+ 3. The student wants to know what topics s/he missed during a class s/he skipped. The answer
181
+ is always "you missed what was on the syllabus."
182
+ 4. The student is protesting a grade without reference to specific points of objection.
183
+ See the policy on protesting a grade in the syllabus. These e-mails tend to be expressive
184
+ utility on the part of the student and do not require a response from me. Students interested
185
+ in improving their knowledge of material should see me during office hours.
186
+ 5. The students wants to know how many classes s/he missed at some point during the semester.
187
+ I assume the student has a better answer to that question than me until the end of the semester.
188
+ 6. The student is requesting an extension on an assignment for which the syllabus already
189
+ established the deadline. The answer is always "no".
190
+ 7. The student is ["grade grubbing"](https://www.math.uh.edu/~tomforde/GradeGrubbing.html)
191
+ or asking to round up a grade. The answer is always "no".
192
+ 8. The student is asking for an extra credit opportunity, a request that amounts to more
193
+ grading for the professor. The answer is "no".
194
+
195
+
196
+ ## Make-Up Exam Policy
197
+
198
+ There are **NO** make-ups for missed exams. Don't bother asking.
199
+
200
+ ## Academic Dishonesty Policy
201
+
202
+ Don’t cheat. Don’t be that guy. Yes, you. You know exactly what I’m talking about too.
203
+
204
+ ## Disabilities Policy
205
+
206
+ Federal law mandates the provision of services at the university-level to qualified
207
+ students with disabilities. Make sure to include all that relevant information here.
208
+
209
+ \newpage
210
+
211
+ # Class Schedule
212
+
213
+ Students must read the following before Tuesday's class session. Important: class readings
214
+ are subject to change, contingent on mitigating circumstances and the progress we make as
215
+ a class. Students are encouraged to attend lectures and check the course website for updates.
216
+
217
+ ## `r advdate(mon, 1)`: Syllabus Day
218
+
219
+ *No class Thursday (Political scientists usually have a conference to start the semester).*
220
+
221
+ Read *all* associated documents on course website.
222
+
223
+ - [Taking Good Notes](http://svmiller.com/blog/2014/09/taking-good-notes/)
224
+ - [Dos and Dont's of Writing for Students](http://svmiller.com/blog/2015/06/dos-and-donts-of-writing-for-students/)
225
+ - [Assorted Tips for Students on Writing Research Papers](http://svmiller.com/blog/2015/12/assorted-tips-students-research-papers/)
226
+ - [Exam Grading Policy](https://www.dropbox.com/s/apihjs7di81aqcv/svm-exam-grading-policy.pdf?dl=0)
227
+ - [Fun with Attendance and Grades (i.e. Students Should Attend Class)](http://svmiller.com/blog/2016/05/fun-with-attendance-grades/)
228
+
229
+
230
+ ## `r advdate(mon, 2)`: The First Topic Where We Read John Vasquez
231
+
232
+ ```{r, echo = FALSE, results="asis"}
233
+ # bib[author = "vasquez"]
234
+ ```
235
+
236
+ ## `r advdate(mon, 3)`: Read the Nos. 90-97 Items in My Bib
237
+
238
+ ```{r, echo = FALSE, results="asis", eval=F}
239
+ bib[90:97]
240
+ ```
241
+
242
+ *Your "Slow Ride" appreciation paper is due in Thursday's class*.
243
+
244
+ ## `r advdate(mon, 4)`: Read Bib Item No. 120
245
+
246
+ ```{r, echo = FALSE, results="asis", eval=F}
247
+ bib[120]
248
+ ```
249
+
250
+
251
+
252
+ ## `r advdate(mon, 5)`: The Fourth Topic with Bib Item No. 510
253
+
254
+ ```{r, echo = FALSE, results="asis", eval=F}
255
+ bib[510]
256
+ ```
257
+
258
+ ## `r advdate(mon, 6)`: Keep
259
+ ## `r advdate(mon, 7)`: Going
260
+ ## `r advdate(mon, 8)`: Down
261
+
262
+ ## `r advdate(mon, 9)`: the
263
+
264
+ ## `r advdate(mon, 10)`: Line
265
+
266
+ ## `r advdate(mon, 11)`: Until
267
+
268
+ ## `r advdate(mon, 12)`: You
269
+
270
+ ## `r advdate(mon, 13)`: Are
271
+
272
+ ## `r advdate(mon, 14)`: Done
273
+
274
+ ## `r advdate(mon, 15)`: with
275
+
276
+
277
+ ## `r advdate(mon, 16)`: your
278
+
279
+
280
+ ## `r advdate(mon, 17)`: Syllabus
@@ -0,0 +1,386 @@
1
+ ---
2
+ title: "Steve's Xaringan Presentation"
3
+ subtitle: "POSC 0000 -- It Would Be Cool If This Were an Actual Class Presentation"
4
+ author: "Steven V. Miller<br /> <br /> <br /> Department of Political Science"
5
+ institute: Department of Political Science
6
+ output:
7
+ xaringan::moon_reader:
8
+ css: ["default", "~/desenv/galaaz/sty/svm-xaringan-style.css"]
9
+ lib_dir: libs
10
+ nature:
11
+ highlightStyle: github
12
+ highlightLines: true
13
+ countIncrementalSlides: false
14
+ ---
15
+
16
+ ```{r setup, include=FALSE}
17
+ options(htmltools.dir.version = FALSE)
18
+ knitr::opts_chunk$set(dev = 'svg')
19
+ options(device = function(file, width, height) {
20
+ svg(tempfile(), width = width, height = height)
21
+ })
22
+ library(tidyverse)
23
+ library(stevemisc)
24
+ ```
25
+
26
+
27
+
28
+ # Install Xaringan First
29
+
30
+ Install the **xaringan** package from [Github](https://github.com/yihui/xaringan):
31
+
32
+ ```{r eval=FALSE, tidy=FALSE}
33
+ devtools::install_github("yihui/xaringan")
34
+ ```
35
+
36
+
37
+ You are recommended to use the [RStudio IDE](https://www.rstudio.com/products/rstudio/), but you do not have to.
38
+
39
+ - Create a new R Markdown document from the menu `File -> New File -> R Markdown -> From Template -> Ninja Presentation`;<sup>1</sup>
40
+ - Click the `Knit` button to compile it.
41
+
42
+ ---
43
+
44
+ # remark.js Maximizes the Presentation Value
45
+
46
+ Press `h` or `?` to see controls you have in remark.js.
47
+
48
+ Hit `Esc` to exit that screen.
49
+
50
+
51
+
52
+ ---
53
+
54
+ class: center, middle
55
+
56
+ # You can do this to your slides if you want
57
+ ## Add `class: center, middle` to the start of your slide.
58
+ ### Perhaps you want the appearance of a secondary title slide, which is what this will do.
59
+
60
+ For example, check this out...
61
+
62
+ ---
63
+
64
+ class: center, middle
65
+
66
+ # Pop Music and Political Science
67
+ ## POSC 0000 -- It Would Be Cool If This Were an Actual Class Presentation
68
+ ### I am not funny and you will be forgiven for thinking of me as impossibly uncool.
69
+
70
+
71
+
72
+ ---
73
+
74
+ # Sheena Easton and Total Conflict
75
+
76
+ Sheena Easton describes the following scenario for her baby:
77
+
78
+ - Takes the morning train
79
+ - Works from nine 'til five
80
+ - Takes another train home again
81
+ - Finds Sheena Easton waiting for him
82
+
83
+ --
84
+
85
+ Sheena Easton and her baby are playing a **zero-sum (total conflict)** game.
86
+
87
+ - Akin to Holmes-Moriarty game (see: von Neumann and Morgenstern), or "matching pennies."
88
+ - Useful for modeling strategic counterterrorism dilemmas between a government and terrorist group.
89
+
90
+
91
+ ---
92
+
93
+ # A Total Conflict Between Sheena Easton and Her Baby
94
+
95
+ | | Sheena Easton Stays Home | Sheena Easton Goes to Baby's Work |
96
+ |-------------------------|---------------------|------------------|
97
+ | **Baby Home Again** | -100, **100** | **100**, 0 |
98
+ | **Baby Stays at Work** | **50**, 0 | -100, **100** |
99
+
100
+ --
101
+
102
+ <br />
103
+
104
+ Notice we have no pure strategies, and no Nash equilibrium.
105
+
106
+ - Sheena Easton wants to proverbially "match pennies."
107
+ - Her baby has diametrically opposed preferences, fearing for his safety.
108
+
109
+ Solution: mixed strategy.
110
+
111
+ ---
112
+ background-image: url(https://media.giphy.com/media/dqZSIfquVhSg0/giphy.gif)
113
+ background-position: 50% 50%
114
+ background-size: 100%
115
+ class: center, bottom, fullscale
116
+
117
+ # Run...
118
+
119
+ ---
120
+
121
+ # Congressman Astley's Re-election Platform
122
+
123
+ Assume Congressman Astley presides over a competitive district in which he seeks reappointment. He promises he's:
124
+
125
+ - Never gonna give you up.
126
+ - Never gonna let you down.
127
+ - Never gonna run around and desert you.
128
+ - Never gonna make you cry.
129
+ - Never gonna say goodbye.
130
+ - Never gonna tell a lie and hurt you.
131
+
132
+ Are these promises (if credible) sufficient to secure re-election?
133
+
134
+ ---
135
+
136
+ ```{r, eval = T, echo = F, fig.width=11, fig.height = 8, message=F, dev='svg', fig.cap = "SDFSFDSFS"}
137
+
138
+ df <- data.frame(x = rnorm(1000))
139
+ x <- df$x
140
+
141
+ ggplot(df, aes(x)) +
142
+ theme_steve_web() +
143
+ stat_function(fun = dnorm, colour = "black") +
144
+ scale_x_continuous(limits = c(-4, 4),
145
+ breaks = c(-4, 0, 4),
146
+ labels = c("Complete\nEmotional\nNeglect",
147
+ "Never Gonna Give You Up\nLet You Down\nRun Around and Desert You\n(Preference of Median Voter)",
148
+ "Maximum\nEmotional\nSupport")) +
149
+ geom_vline(xintercept = 0) +
150
+ geom_vline(xintercept = 1, linetype="dashed") +
151
+ geom_vline(xintercept = -2, linetype = "dashed") +
152
+ geom_vline(xintercept = -.5, linetype = "dotted") +
153
+ scale_y_continuous(limits = c(0, .5), breaks = NULL, label=NULL) +
154
+ xlab("A Unidimensional Continuum of the Policy Space of Emotional Support") +
155
+ ylab("") +
156
+ stat_function(fun = dnorm,
157
+ xlim = c(-4,-2),
158
+ size=0,
159
+ geom = "area", fill="#f8766d", alpha=1) +
160
+ stat_function(fun = dnorm,
161
+ xlim = c(1, 4),
162
+ size=0,
163
+ geom = "area", fill="#619cff", alpha=1) +
164
+ stat_function(fun = dnorm,
165
+ xlim = c(-.5, 1),
166
+ size=0,
167
+ geom = "area", fill="#619cff", alpha=.4) +
168
+ stat_function(fun = dnorm,
169
+ xlim = c(-2, -.5),
170
+ size=0,
171
+ geom = "area", fill="#f8766d", alpha=.4) +
172
+ annotate("text", label="Astley's rival is promising\nfar less in the (public?) good\nof emotional support",
173
+ size = 3.5, family="Open Sans",
174
+ x = -2.1, y = .4,
175
+ hjust = 1) +
176
+ annotate("text",
177
+ label="Congressman Astley is pledging\nmore emotional support\n(i.e. never gonna make you cry/say goodbye/tell a lie/hurt you)\nthan most his constituents want",
178
+ size = 3.5, family="Open Sans",
179
+ x = 1.1, y = .4,
180
+ hjust = 0) +
181
+ annotate("text",
182
+ label="Preferences\ncloser to\nAstley's\nrival",
183
+ size = 3.5, family="Open Sans",
184
+ x = -1.2, y = .45,
185
+ hjust = .5) +
186
+ annotate("text",
187
+ label="Preferences\ncloser to\nCongressman\nAstley",
188
+ size = 3.5, family="Open Sans",
189
+ x = .5, y = .45,
190
+ hjust = .5) +
191
+ labs(title = "Median Voter Theorem Suggests Congressman Astley Secures Re-election Against His Rival",
192
+ subtitle = "Assuming a unidimensional policy space and single-peaked preferences, Congressman Astley is closer to the median voter than his rival and wins the election.") +
193
+ geom_hline(yintercept = 0) +
194
+ geom_vline(xintercept = -4)
195
+
196
+
197
+
198
+
199
+ ```
200
+
201
+ ---
202
+ background-image: url(https://media.giphy.com/media/Vuw9m5wXviFIQ/giphy.gif)
203
+ background-position: 50% 50%
204
+ background-size: 100%
205
+ class: center, bottom, fullscale
206
+
207
+ # Re-election Dance
208
+
209
+
210
+
211
+ ---
212
+
213
+ # Caribbean Queen and Operation Urgent Fury
214
+
215
+ .pull-left[
216
+
217
+ Billy Ocean released "Caribbean Queen" in 1984.
218
+
219
+ - Emphasized sharing the same dream
220
+ - Hearts beating as one
221
+
222
+ "Caribbean Queen" is about the poor execution of Operation Urgent Fury.
223
+
224
+ - Coordination problems plagued its execution from the start.
225
+ - Echoed JCS chairman David Jones' frustrations with military establishment.
226
+ ]
227
+
228
+ .pull-right[
229
+
230
+ ![](http://wearethemighty.wpengine.netdna-cdn.com/wp-content/uploads/2016/05/GrenadaNewsCartoon.jpg)
231
+
232
+ *This seriously happened, btw..*
233
+ ]
234
+
235
+ Billy Ocean is advocating for what became the Goldwater-Nichols Act.
236
+
237
+ - Wanted to take advantage of **economies of scale**, resolve **coordination problems** in U.S. military.
238
+
239
+ ---
240
+
241
+ background-image: url(https://i.makeagif.com/media/9-05-2015/auHafh.gif)
242
+ background-position: 50% 50%
243
+ background-size: 100%
244
+ class: center, bottom, fullscale
245
+
246
+ # The military establishment was the tiger we wanted to tame all along.
247
+
248
+
249
+ ---
250
+
251
+ # The Good Day Hypothesis
252
+
253
+ We know the following about Ice Cube's day.
254
+
255
+ 1. The Lakers beat the Supersonics.
256
+ 2. No helicopter looked for a murder.
257
+ 3. Consumed Fatburger at 2 a.m.
258
+ 4. Goodyear blimp: "Ice Cube's a pimp."
259
+
260
+ --
261
+
262
+ This leads to two different hypotheses:
263
+
264
+ - $H_0$: Ice Cube's day is statistically indistinguishable from a typical day.
265
+ - $H_1$: Ice Cube is having a good day.
266
+
267
+ These hypotheses are tested using archival data from Ice Cube's life to estimate an item response model of the "goodness" of Ice Cube's days.
268
+
269
+ ---
270
+
271
+ ```{r, eval = T, echo = F, fig.width=11, fig.height = 8, message=F, dev='svg', fig.cap = "SDFSFDSFS"}
272
+ interval1 <- -qnorm((1-0.9)/2) # 90% multiplier
273
+ interval2 <- -qnorm((1-0.95)/2) # 95% multiplier
274
+
275
+ tribble(
276
+ ~variable, ~est, ~se,
277
+ "Latent Estimate of\nIce Cube's Day", 1.6, .231
278
+ ) %>%
279
+ ggplot(.) + theme_steve_web() +
280
+ geom_hline(yintercept = .5, color = "red", lty=2) +
281
+ geom_linerange(aes(x = variable, ymin = est - se*interval1,
282
+ ymax = est + se*interval1),
283
+ lwd = 1, position = position_dodge(width = 1/2)) +
284
+ geom_pointrange(aes(x = variable, y = est, ymin = est - se*interval2,
285
+ ymax = est + se*interval2),
286
+ lwd = 1/2, position = position_dodge(width = 1/2),
287
+ fill = "WHITE") +
288
+ coord_flip() + xlab("") + ylab("Latent Estimate") +
289
+ labs(title = "Latent Estimates from Ice Cube's Archives Lend Support to the 'Good Day' Hypothesis",
290
+ subtitle = "Latent estimates are drawn from an item response model of indicators of the quality of Ice Cube's days. These include whether he had to use his A.K.",
291
+ caption = "Data: Ice Cube's Archives, obviously fictional. Red value of .5 indicate likelihood of 'good day.'")
292
+
293
+
294
+
295
+ ```
296
+
297
+ ---
298
+
299
+ background-image: url(https://media.giphy.com/media/cgh25bl5dgK3u/giphy.gif)
300
+ background-position: 50% 50%
301
+ background-size: 100%
302
+ class: center, bottom, fullscale
303
+
304
+ ---
305
+
306
+ class: center, middle
307
+
308
+ # You Can Do Other Stuff in Xaringan Too
309
+ ## POSC 0000 -- It Would Be Cool If This Were an Actual Class Presentation
310
+ ### I might use it mostly for the ability to put GIFs in class presentations, but it's flexible enough to do almost anything.
311
+
312
+ ---
313
+
314
+ Show some R code and execute it if you'd like.
315
+
316
+ ```{r}
317
+ pi
318
+
319
+ 3+5
320
+
321
+ rnorm(10)
322
+
323
+ ```
324
+
325
+
326
+ ---
327
+
328
+ Here's a simple ultimatum game, a la Fearon (1995). Done via `DiagrammeR`.
329
+
330
+ ```{r, echo=F, eval=T}
331
+ library(DiagrammeR)
332
+ grViz("
333
+ digraph {
334
+ # Multiple level nodes
335
+ node [shape = square, color=CornflowerBlue]
336
+ A [label = 'A'];
337
+ 0 [label = '0', shape = none];
338
+ B [label = 'B'];
339
+ 1 [label = '1', shape = none];
340
+ Accept [label = '1 - x, x', shape = none];
341
+ N;
342
+ Awins [shape = none, label = '1 - k, k'];
343
+ Bwins [shape = none, label = '-k, 1 - k']
344
+
345
+
346
+
347
+ # Connect nodes with edges and labels
348
+ A -> 0 [arrowhead= none]
349
+ A -> B
350
+ A -> 1 [arrowhead = none]
351
+ B -> Accept [headlabel = 'Accept', labeldistance = 5, labelangle=75]
352
+ B -> N [label = ' Reject']
353
+ N -> Awins [headlabel = 'A wins (1 - p)', labeldistance=4.5 ,
354
+ labelangle=75]
355
+ N -> Bwins [label = 'B wins (p)']
356
+ }
357
+
358
+ [1]: 'A'
359
+ [2]: '0'
360
+ [3]: paste0('Model 3\\n Split 3')
361
+ [4]: paste0('Model 6\\n Split 4')
362
+ ")
363
+
364
+ ```
365
+
366
+ ---
367
+
368
+ # Conclusion
369
+
370
+ Xaringan is a nifty Rstudio add-on/package for creating HTML presentations.
371
+
372
+ - I think I'm still more inclined toward Beamer but Xaringan has tons of flexibility.
373
+ - Have an interactive component to your presentation (e.g. `leaflet` or a Shiny app)? You probably want Xaringan.
374
+
375
+ Plus, you can put GIFs into your presentation with Xaringan. That's nifty. Maybe students will like that.
376
+
377
+
378
+
379
+ ---
380
+
381
+ background-image: url(https://i.imgur.com/IHeUeZ9.gif)
382
+ background-position: 50% 50%
383
+ background-size: 100%
384
+ class: center, bottom, fullscale
385
+
386
+ Questions? Hate mail? Stay out of my mentions @stevenvmiller
File without changes