├── .gitignore
├── DashApp
├── app.py
├── assets
│ └── style.css
└── data
│ └── stockdata2.csv
├── LICENSE
├── Last Christmas
├── README.md
├── data.csv
└── main.py
├── README.md
├── WM2018
├── Phyton
│ └── crawler.py
├── R
│ ├── Rhelper.R
│ ├── compare_scores.R
│ ├── game_data.R
│ └── play_game.R
├── README.md
├── WM_scores.R
├── data
│ ├── bets2018.csv
│ ├── fussballmathe
│ │ └── results.csv
│ └── history
│ │ ├── 1930-Uruguay.txt
│ │ ├── 1934-Italy.txt
│ │ ├── 1938-France.txt
│ │ ├── 1950-Brazil.txt
│ │ ├── 1954-Switzerland.txt
│ │ ├── 1958-Sweden.txt
│ │ ├── 1962-Chile.txt
│ │ ├── 1966-England.txt
│ │ ├── 1970-Mexico.txt
│ │ ├── 1974-Germany.txt
│ │ ├── 1978-Agentina.txt
│ │ ├── 1982-Spain.txt
│ │ ├── 1986-Mexico.txt
│ │ ├── 1990-Italy.txt
│ │ ├── 1994-USA.txt
│ │ ├── 1998-France.txt
│ │ ├── 2002-Korea.txt
│ │ ├── 2006-Germany.txt
│ │ ├── 2010-South Africa.txt
│ │ └── 2014-Brazil.txt
└── plots
│ ├── points-for-all-models.png
│ └── score-distribution.png
├── airflow
├── blog.py
├── cfg.py
├── data_route.csv
└── queries.py
├── apa
└── APA_TimesRoman_12pt.stt
├── bash_script_collection
├── .dockerignore
├── .gitignore
├── Dockerfile
├── README.md
├── bash_script_collection.Rproj
├── docker_error_logs
├── docker_setup
├── git_repair
├── global_conf.sh
├── index.html
├── index_addins
│ └── Hintergrund2.png
├── some_folder
│ ├── Test Matthias.rtf
│ ├── TestRobin.rtf
│ ├── hello_from_the_other_side.rtf
│ └── some_file
└── testapp
│ ├── server.R
│ ├── ui.R
│ └── www
│ └── my_style.css
├── bayesian_regularization
├── .gitignore
├── bayesian_updating.R
├── brms_models.R
├── coeff_comparison.R
├── generalized_ridge_ols_comparison.R
├── generalized_ridge_point_estimator.R
├── rstan_model.stan
└── utils.R
├── benzinpreise
├── README.md
├── stations.R
├── stations_init.R
└── timeformat-test.R
├── blog.Rproj
├── bokeh_dashboard
├── .DS_Store
├── README.md
├── bokeh-dashboard-final.py
├── bokeh-hist-bar-scatter.py
└── bokeh-hist-bar.py
├── community_detection
└── lesmis_community_detection.R
├── compose
├── bookings
│ ├── .Rprofile
│ ├── .dockerignore
│ ├── Dockerfile
│ ├── Makefile
│ ├── code
│ │ ├── api.R
│ │ └── run.R
│ ├── data
│ │ └── hotel_bookings.csv
│ ├── docker-compose.yml
│ ├── renv.lock
│ ├── renv
│ │ ├── activate.R
│ │ ├── library
│ │ │ └── R-3.6
│ │ │ │ └── x86_64-apple-darwin15.6.0
│ │ │ │ ├── BH
│ │ │ │ ├── DBI
│ │ │ │ ├── DT
│ │ │ │ ├── ISOcodes
│ │ │ │ ├── MASS
│ │ │ │ ├── Matrix
│ │ │ │ ├── NLP
│ │ │ │ ├── PKI
│ │ │ │ ├── R6
│ │ │ │ ├── RColorBrewer
│ │ │ │ ├── RPostgres
│ │ │ │ ├── Rcpp
│ │ │ │ ├── RcppArmadillo
│ │ │ │ ├── SQUAREM
│ │ │ │ ├── SnowballC
│ │ │ │ ├── TTR
│ │ │ │ ├── anomalize
│ │ │ │ ├── askpass
│ │ │ │ ├── assertthat
│ │ │ │ ├── backports
│ │ │ │ ├── base64enc
│ │ │ │ ├── bit
│ │ │ │ ├── bit64
│ │ │ │ ├── blob
│ │ │ │ ├── broom
│ │ │ │ ├── callr
│ │ │ │ ├── cli
│ │ │ │ ├── clipr
│ │ │ │ ├── colorspace
│ │ │ │ ├── crayon
│ │ │ │ ├── crosstalk
│ │ │ │ ├── curl
│ │ │ │ ├── data.table
│ │ │ │ ├── desc
│ │ │ │ ├── digest
│ │ │ │ ├── dplyr
│ │ │ │ ├── dtt
│ │ │ │ ├── ellipsis
│ │ │ │ ├── evaluate
│ │ │ │ ├── fansi
│ │ │ │ ├── farver
│ │ │ │ ├── forcats
│ │ │ │ ├── forecast
│ │ │ │ ├── fracdiff
│ │ │ │ ├── fs
│ │ │ │ ├── furrr
│ │ │ │ ├── future
│ │ │ │ ├── generics
│ │ │ │ ├── ggplot2
│ │ │ │ ├── gh
│ │ │ │ ├── git2r
│ │ │ │ ├── globals
│ │ │ │ ├── glue
│ │ │ │ ├── gower
│ │ │ │ ├── gtable
│ │ │ │ ├── hexbin
│ │ │ │ ├── highr
│ │ │ │ ├── hms
│ │ │ │ ├── htmltools
│ │ │ │ ├── htmlwidgets
│ │ │ │ ├── httpuv
│ │ │ │ ├── httr
│ │ │ │ ├── hunspell
│ │ │ │ ├── igraph
│ │ │ │ ├── ini
│ │ │ │ ├── ipred
│ │ │ │ ├── janeaustenr
│ │ │ │ ├── jsonlite
│ │ │ │ ├── kableExtra
│ │ │ │ ├── knitr
│ │ │ │ ├── labeling
│ │ │ │ ├── later
│ │ │ │ ├── lattice
│ │ │ │ ├── lava
│ │ │ │ ├── lazyeval
│ │ │ │ ├── lifecycle
│ │ │ │ ├── listenv
│ │ │ │ ├── lmtest
│ │ │ │ ├── lubridate
│ │ │ │ ├── magrittr
│ │ │ │ ├── markdown
│ │ │ │ ├── mgcv
│ │ │ │ ├── mime
│ │ │ │ ├── munsell
│ │ │ │ ├── nlme
│ │ │ │ ├── numDeriv
│ │ │ │ ├── odbc
│ │ │ │ ├── openssl
│ │ │ │ ├── padr
│ │ │ │ ├── pillar
│ │ │ │ ├── pkgconfig
│ │ │ │ ├── plogr
│ │ │ │ ├── plotly
│ │ │ │ ├── plumber
│ │ │ │ ├── plyr
│ │ │ │ ├── prettyunits
│ │ │ │ ├── processx
│ │ │ │ ├── prodlim
│ │ │ │ ├── progress
│ │ │ │ ├── promises
│ │ │ │ ├── ps
│ │ │ │ ├── purrr
│ │ │ │ ├── quadprog
│ │ │ │ ├── quantmod
│ │ │ │ ├── readr
│ │ │ │ ├── recipes
│ │ │ │ ├── rematch2
│ │ │ │ ├── renv
│ │ │ │ ├── DESCRIPTION
│ │ │ │ ├── INDEX
│ │ │ │ ├── LICENSE
│ │ │ │ ├── Meta
│ │ │ │ │ ├── Rd.rds
│ │ │ │ │ ├── features.rds
│ │ │ │ │ ├── hsearch.rds
│ │ │ │ │ ├── links.rds
│ │ │ │ │ ├── nsInfo.rds
│ │ │ │ │ ├── package.rds
│ │ │ │ │ └── vignette.rds
│ │ │ │ ├── NAMESPACE
│ │ │ │ ├── NEWS.md
│ │ │ │ ├── R
│ │ │ │ │ ├── renv
│ │ │ │ │ ├── renv.rdb
│ │ │ │ │ └── renv.rdx
│ │ │ │ ├── doc
│ │ │ │ │ ├── ci.R
│ │ │ │ │ ├── ci.Rmd
│ │ │ │ │ ├── ci.html
│ │ │ │ │ ├── collaborating.R
│ │ │ │ │ ├── collaborating.Rmd
│ │ │ │ │ ├── collaborating.html
│ │ │ │ │ ├── docker.R
│ │ │ │ │ ├── docker.Rmd
│ │ │ │ │ ├── docker.html
│ │ │ │ │ ├── faq.R
│ │ │ │ │ ├── faq.Rmd
│ │ │ │ │ ├── faq.html
│ │ │ │ │ ├── index.html
│ │ │ │ │ ├── local-sources.R
│ │ │ │ │ ├── local-sources.Rmd
│ │ │ │ │ ├── local-sources.html
│ │ │ │ │ ├── lockfile.R
│ │ │ │ │ ├── lockfile.Rmd
│ │ │ │ │ ├── lockfile.html
│ │ │ │ │ ├── packages.R
│ │ │ │ │ ├── packages.Rmd
│ │ │ │ │ ├── packages.html
│ │ │ │ │ ├── python.R
│ │ │ │ │ ├── python.Rmd
│ │ │ │ │ ├── python.html
│ │ │ │ │ ├── renv.R
│ │ │ │ │ ├── renv.Rmd
│ │ │ │ │ └── renv.html
│ │ │ │ ├── help
│ │ │ │ │ ├── AnIndex
│ │ │ │ │ ├── aliases.rds
│ │ │ │ │ ├── paths.rds
│ │ │ │ │ ├── renv.rdb
│ │ │ │ │ └── renv.rdx
│ │ │ │ ├── html
│ │ │ │ │ ├── 00Index.html
│ │ │ │ │ └── R.css
│ │ │ │ └── resources
│ │ │ │ │ ├── WELCOME
│ │ │ │ │ ├── activate.R
│ │ │ │ │ ├── scripts-git-askpass.sh
│ │ │ │ │ └── scripts-repos-cache.R
│ │ │ │ ├── reshape2
│ │ │ │ ├── rjson
│ │ │ │ ├── rlang
│ │ │ │ ├── rmarkdown
│ │ │ │ ├── rprojroot
│ │ │ │ ├── rsample
│ │ │ │ ├── rstudioapi
│ │ │ │ ├── rtweet
│ │ │ │ ├── rvest
│ │ │ │ ├── scales
│ │ │ │ ├── selectr
│ │ │ │ ├── slam
│ │ │ │ ├── slider
│ │ │ │ ├── stopwords
│ │ │ │ ├── stringi
│ │ │ │ ├── stringr
│ │ │ │ ├── sweep
│ │ │ │ ├── sys
│ │ │ │ ├── syuzhet
│ │ │ │ ├── textshape
│ │ │ │ ├── tibble
│ │ │ │ ├── tibbletime
│ │ │ │ ├── tidyr
│ │ │ │ ├── tidyselect
│ │ │ │ ├── tidytext
│ │ │ │ ├── timeDate
│ │ │ │ ├── timetk
│ │ │ │ ├── tinytex
│ │ │ │ ├── tm
│ │ │ │ ├── tokenizers
│ │ │ │ ├── tseries
│ │ │ │ ├── twitteR
│ │ │ │ ├── urca
│ │ │ │ ├── usethis
│ │ │ │ ├── utf8
│ │ │ │ ├── vctrs
│ │ │ │ ├── viridisLite
│ │ │ │ ├── warp
│ │ │ │ ├── webshot
│ │ │ │ ├── whisker
│ │ │ │ ├── withr
│ │ │ │ ├── wordcloud
│ │ │ │ ├── xfun
│ │ │ │ ├── xml2
│ │ │ │ ├── xts
│ │ │ │ ├── yaml
│ │ │ │ └── zoo
│ │ └── settings.dcf
│ └── startup.sh
└── lb
│ ├── Dockerfile
│ ├── Makefile
│ ├── default.conf
│ └── ssl
│ ├── certs
│ ├── cert.pem
│ └── nginx-selfsigned.crt
│ └── private
│ ├── key.pem
│ └── nginx-selfsigned.key
├── cross-validation
├── README.md
└── cv_from_scratch.R
├── dive
└── dive.R
├── dynamic-shinyUI-pt1
├── code
│ ├── dynamic_boxes.R
│ ├── dynamic_tabs.R
│ └── static_boxes.R
├── images
│ ├── Bildschirmfoto 2019-08-14 um 09.44.53.png
│ └── Bildschirmfoto 2019-08-14 um 09.45.46.png
└── shiny_dynamic_ui.md
├── dynamic-shinyUI-pt2
├── code
│ ├── example1.R
│ └── example2.R
├── images
│ ├── error.png
│ └── example1.png
└── shiny_dynamic_ui_2.md
├── flexdashboard
├── diamonds_dash.Rmd
└── resources
│ ├── STATWORX_2.jpg
│ └── bootstrap.css
├── flowchart
├── README.md
├── R_network_functions
│ ├── dataprep
│ │ └── foo_01.R
│ ├── method
│ │ └── foo_02.R
│ ├── script_01.R
│ └── script_02.R
├── create_network.R
├── getnetwork.R
└── plots
│ ├── example-network-helfRlein.png
│ └── improved-network.png
├── food_for_regression
├── .DS_Store
└── code
│ ├── code_food_for_regression2.R
│ └── food_for_regression_post1.R
├── interactive_histogram
├── README.md
├── interactive_histogram.ipynb
└── interactive_histogram.py
├── interactive_network_visualization
├── global.R
├── lesmis_network.R
├── server.R
└── ui.R
├── movie_recommendation
├── app.R
├── data_server.R
├── load_data.R
└── ui_server.R
├── pandas_vs_datatable
├── README.md
├── code
│ ├── analysis.py
│ ├── arrange.R
│ ├── arrange.py
│ ├── create_datasets.R
│ ├── create_szenarios.R
│ ├── filter.R
│ ├── filter.py
│ ├── functions.R
│ ├── mutate.R
│ ├── mutate.py
│ ├── select.R
│ ├── select.py
│ ├── summarise.R
│ └── summarize.py
├── data
│ └── .DS_Store
└── output
│ └── .DS_Store
├── r-script-in-docker
├── .gitignore
├── 01_data
│ ├── .gitignore
│ ├── us-500.csv
│ └── us-500.zip
├── 02_code
│ ├── install_packages.R
│ ├── myScript.R
│ └── myScriptFinal.R
├── 03_output
│ └── .gitignore
├── 2019-02-22_r-script-in-docker.md
├── Dockerfile
├── Dockerfile.final
├── R-Script in Docker.Rproj
├── docker build.png
└── docker run.png
├── requirements.txt
├── shiny_friend_scorer
├── data
│ ├── friend_score.RDS
│ ├── raw
│ │ ├── friend_score.csv
│ │ └── visit_log.csv
│ └── visit_log.RDS
├── functions
│ └── utils.R
├── global.R
├── misc
│ └── init_friend_data.R
├── server.R
└── ui.R
├── shinyapp-in-docker
├── .gitignore
├── Dockerfile
└── example-app
│ ├── .gitignore
│ ├── example-app.Rproj
│ ├── global.R
│ ├── renv.lock
│ ├── renv
│ ├── .gitignore
│ ├── activate.R
│ └── settings.dcf
│ ├── server.R
│ └── ui.R
├── slackemoji
├── How we use emojis.md
├── Slack_export
│ └── example
│ │ ├── 2017-11-14.json
│ │ └── 2018-03-22.json
├── emojis
│ ├── emoji_categories.json
│ ├── emojilist.txt
│ └── new_emojilist.txt
├── eval_emoji.R
└── plots
│ ├── emoji-category.png
│ ├── emoji-network-category.html
│ ├── emoji-network-category_files
│ ├── d3-4.5.0
│ │ ├── LICENSE
│ │ └── d3.min.js
│ ├── htmlwidgets-1.3
│ │ └── htmlwidgets.js
│ ├── sankey-1
│ │ ├── d3-4.5.0
│ │ │ ├── LICENSE
│ │ │ └── d3.min.js
│ │ └── sankey.js
│ └── sankeyNetwork-binding-0.4
│ │ └── sankeyNetwork.js
│ ├── emoji-over-day-with-icon.svg
│ ├── emoji-over-day.png
│ ├── emoji-over-year.png
│ ├── emoji-plot.svg
│ ├── emoji-plotdetails.svg
│ ├── wordcloud-emoji.png
│ ├── wordcloud-noemoji.png
│ └── wordcloud.png
├── sparse_matrix
├── README.md
├── plots
│ ├── sparse-normal-matrixoperation.png
│ └── sparse-normal-speichergroesse.png
├── results.rds
└── sparsematrix.R
├── svg_logos
├── R
│ ├── R_black.svg
│ ├── R_colour.svg
│ ├── R_darkgrey.svg
│ ├── R_lightgrey.svg
│ └── R_white.svg
└── README.md
├── time series forecasting
├── README.md
└── tax.csv
└── unittest
├── quadratic_function.R
└── test_quadratic_equation.R
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .Ruserdata
5 | .DS_Store
6 |
7 | .ipynb_checkpoints
8 |
9 | # log files
10 | bash_script_collection/docker_log_files
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 STATWORX
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Last Christmas/README.md:
--------------------------------------------------------------------------------
1 | # Forecasting Last Christmas Search Volume on Google Trends using Deep Learning
2 |
3 | If you want to know more details about why we did it and how the code works, check out our [blog post](https://www.statworx.com/de/blog/forecasting-last-christmas-search-volume-on-google-trends-using-deep-learning/)!
4 |
--------------------------------------------------------------------------------
/Last Christmas/data.csv:
--------------------------------------------------------------------------------
1 | month,y
2 | 2004-01,2
3 | 2004-02,1
4 | 2004-03,0
5 | 2004-04,0
6 | 2004-05,1
7 | 2004-06,1
8 | 2004-07,1
9 | 2004-08,1
10 | 2004-09,2
11 | 2004-10,4
12 | 2004-11,21
13 | 2004-12,69
14 | 2005-01,1
15 | 2005-02,1
16 | 2005-03,1
17 | 2005-04,1
18 | 2005-05,0
19 | 2005-06,0
20 | 2005-07,1
21 | 2005-08,1
22 | 2005-09,0
23 | 2005-10,2
24 | 2005-11,18
25 | 2005-12,83
26 | 2006-01,3
27 | 2006-02,1
28 | 2006-03,1
29 | 2006-04,0
30 | 2006-05,1
31 | 2006-06,1
32 | 2006-07,1
33 | 2006-08,1
34 | 2006-09,1
35 | 2006-10,3
36 | 2006-11,15
37 | 2006-12,76
38 | 2007-01,3
39 | 2007-02,1
40 | 2007-03,1
41 | 2007-04,1
42 | 2007-05,1
43 | 2007-06,0
44 | 2007-07,1
45 | 2007-08,1
46 | 2007-09,2
47 | 2007-10,3
48 | 2007-11,17
49 | 2007-12,81
50 | 2008-01,4
51 | 2008-02,1
52 | 2008-03,1
53 | 2008-04,1
54 | 2008-05,1
55 | 2008-06,1
56 | 2008-07,1
57 | 2008-08,1
58 | 2008-09,3
59 | 2008-10,6
60 | 2008-11,21
61 | 2008-12,74
62 | 2009-01,3
63 | 2009-02,1
64 | 2009-03,1
65 | 2009-04,1
66 | 2009-05,0
67 | 2009-06,0
68 | 2009-07,1
69 | 2009-08,1
70 | 2009-09,1
71 | 2009-10,3
72 | 2009-11,20
73 | 2009-12,80
74 | 2010-01,3
75 | 2010-02,1
76 | 2010-03,1
77 | 2010-04,1
78 | 2010-05,2
79 | 2010-06,1
80 | 2010-07,1
81 | 2010-08,1
82 | 2010-09,2
83 | 2010-10,5
84 | 2010-11,23
85 | 2010-12,81
86 | 2011-01,3
87 | 2011-02,2
88 | 2011-03,1
89 | 2011-04,1
90 | 2011-05,0
91 | 2011-06,1
92 | 2011-07,1
93 | 2011-08,2
94 | 2011-09,2
95 | 2011-10,5
96 | 2011-11,30
97 | 2011-12,92
98 | 2012-01,4
99 | 2012-02,2
100 | 2012-03,1
101 | 2012-04,1
102 | 2012-05,1
103 | 2012-06,1
104 | 2012-07,1
105 | 2012-08,1
106 | 2012-09,2
107 | 2012-10,5
108 | 2012-11,16
109 | 2012-12,87
110 | 2013-01,3
111 | 2013-02,3
112 | 2013-03,2
113 | 2013-04,1
114 | 2013-05,1
115 | 2013-06,1
116 | 2013-07,1
117 | 2013-08,1
118 | 2013-09,2
119 | 2013-10,3
120 | 2013-11,16
121 | 2013-12,73
122 | 2014-01,3
123 | 2014-02,2
124 | 2014-03,1
125 | 2014-04,1
126 | 2014-05,1
127 | 2014-06,1
128 | 2014-07,1
129 | 2014-08,1
130 | 2014-09,2
131 | 2014-10,3
132 | 2014-11,18
133 | 2014-12,87
134 | 2015-01,3
135 | 2015-02,2
136 | 2015-03,2
137 | 2015-04,1
138 | 2015-05,1
139 | 2015-06,1
140 | 2015-07,1
141 | 2015-08,1
142 | 2015-09,2
143 | 2015-10,4
144 | 2015-11,18
145 | 2015-12,79
146 | 2016-01,3
147 | 2016-02,1
148 | 2016-03,1
149 | 2016-04,1
150 | 2016-05,1
151 | 2016-06,1
152 | 2016-07,1
153 | 2016-08,1
154 | 2016-09,2
155 | 2016-10,3
156 | 2016-11,21
157 | 2016-12,100
158 | 2017-01,4
159 | 2017-02,1
160 | 2017-03,1
161 | 2017-04,1
162 | 2017-05,1
163 | 2017-06,1
164 | 2017-07,1
165 | 2017-08,1
166 | 2017-09,2
167 | 2017-10,4
168 | 2017-11,18
169 | 2017-12,92
170 | 2018-01,3
171 | 2018-02,2
172 | 2018-03,2
173 | 2018-04,1
174 | 2018-05,1
175 | 2018-06,1
176 | 2018-07,1
177 | 2018-08,1
178 | 2018-09,3
179 | 2018-10,8
180 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Blog
2 | Collection of the codes which are used on our blog at https://www.statworx.com/content-hub/
3 |
--------------------------------------------------------------------------------
/WM2018/Phyton/crawler.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | import pandas as pd
3 | from time import sleep
4 |
5 | # Setting up the Chromedriver
6 | driver = webdriver.Chrome(executable_path="Path to Chromedriver")
7 |
8 | # Call Website
9 | driver.get("http://fussballmathe.de/simulation/")
10 |
11 | # dict for translating the country names
12 | names = {
13 | "Russland" : "Russia" ,
14 | "Saudi-Arabien": "Saudi Arabia",
15 | "Uruguay" : "Uruguay",
16 | "Ägypten" : "Egypt",
17 | "Portugal" : "Portugal",
18 | "Marokko" : "Morocco",
19 | "Iran" : "Iran",
20 | "Spanien" : "Spain",
21 | "Frankreich" : "France",
22 | "Australien" : "Australia",
23 | "Peru" : "Peru",
24 | "Dänemark" : "Denmark",
25 | "Argentinien" : "Argentina",
26 | "Island" : "Island",
27 | "Kroatien" : "Croatia",
28 | "Nigeria" : "Nigeria",
29 | "Brasilien" : "Brazil",
30 | "Schweiz" : "Switzerland",
31 | "Costa Rica" : "Costa Rica",
32 | "Serbien" : "Serbia",
33 | "Deutschland" : "Germany",
34 | "Mexico" : "Mexico",
35 | "Schweden" : "Sweden",
36 | "Südkorea" : "South Korea",
37 | "Belgien" : "Belgium",
38 | "Panama" : "Panama",
39 | "Tunesien" : "Tunesia",
40 | "England" : "England",
41 | "Polen" : "Poland",
42 | "Senegal" : "Senegal",
43 | "Kolumbien" : "Colombia",
44 | "Japan" : "Japan"}
45 |
46 | # Aligning games to groups
47 | games = [1,17,-34,33,-19,2,
48 | 4,18,-35,36,-20,3,
49 | 5,22,-38,37,-21,7,
50 | 6,23,-39,40,-25,8,
51 | 11,24,-43,44,-26,9,
52 | 10,29,-42,41,-28,12,
53 | 13,27,-45,47,-30,14,
54 | 16,32,-48,46,-31,15]
55 |
56 |
57 | # Starting Simulations
58 | n_simulations = 100
59 | df_total_sim = pd.DataFrame()
60 |
61 | for sim in range(n_simulations):
62 | # Find Simulation Elements
63 | driver.find_element_by_id('reps_save').click()
64 | # Getting the website hmtl code
65 | website = driver.page_source
66 | # Reading DataFrames from Website
67 | tables = pd.read_html(website)
68 | df_total = pd.DataFrame()
69 | for i in list(range(8,16)):
70 | tables[i][3] = [sim] * 6
71 | # Replacing country names
72 | for index, value in enumerate(tables[i][0]):
73 | if value in names:
74 | tables[i].iloc[index, 0] = names[value]
75 | for index, value in enumerate(tables[i][2]):
76 | if value in names:
77 | tables[i].iloc[index, 2] = names[value]
78 |
79 | df_total = df_total.append(tables[i])
80 | df_total[4] = games
81 | df_total_sim = df_total_sim.append(df_total)
82 | sleep(5)
83 |
84 | # Cleaning results
85 | df_total_sim[1] = df_total_sim[1].str.replace(':','-')
86 | # Saving results
87 | df_total_sim.to_csv('path to save csv')
88 |
--------------------------------------------------------------------------------
/WM2018/R/Rhelper.R:
--------------------------------------------------------------------------------
1 |
2 | ### R Helper
3 | FindParameter <- function(prob, eta) {
4 | sapply(prob, function(i) {
5 | if (i<.009) {
6 | return (.1)
7 | }
8 | if (i>.995) {
9 | return (eta-.05)
10 | }
11 | return(min(skellam$beta[skellam$prob>i]))
12 | })
13 | }
14 |
15 |
16 | # skellam
17 |
18 | dskellam <- function(x, mu1, mu2) {
19 | return(exp(-(mu1+mu2))*(mu1/mu2)^(x/2)*besselI(2*sqrt(mu1*mu2),nu=x)
20 | )
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/WM2018/R/compare_scores.R:
--------------------------------------------------------------------------------
1 | #' Title comparing scores
2 | #'
3 | #' @description This function compares two given matricies with scores.
4 | #' The first matrix contains the real values.
5 | #' Points are as follows:
6 | #'
7 | #' | | trend | goal difference | result |
8 | #' | :-----: | :---: | :-------------: | :----: |
9 | #' | Victory | 2 | 3 | 4 |
10 | #' | Draw | 2 | - | 4 |
11 | #'
12 | #' @param x1 a matrix with the real scores
13 | #' @param x2 a matrix with the predicted scores
14 | #'
15 | #' @return Retunrs the number of points
16 | #' @export
17 | #'
18 | #' @examples
19 | #' real <- matrix(as.integer(c(5, 0, 0, 1, 0, 1, 3, 3)),
20 | #' ncol = 2, byrow = TRUE)
21 | #' pred <- matrix(as.integer(c(0, 2, 0, 1, 1, 2, 1, 1)),
22 | #' ncol = 2, byrow = TRUE)
23 | #' compare_scores(real, pred)
24 | #'
25 | compare_scores <- function(x1, x2) {
26 | # x1 <- realscores[1:5,]
27 | # x2 <- result_list[[1]][[1]][1:5,]
28 | # x2 <- prefinials[1:5,]
29 | # x2 <- matrix(c(5,1,0,1,1,2,1,1,3,1), ncol = 2, byrow = TRUE)
30 |
31 | #same result
32 | same_score <- apply(X = x1 == x2, FUN = all, MARGIN = 1)
33 | x1 <- matrix(x1[!same_score, ], ncol = 2, byrow = FALSE)
34 | x2 <- matrix(x2[!same_score, ], ncol = 2, byrow = FALSE)
35 |
36 |
37 | # ties
38 | same_diff_equal <- (x1[, 1] == x1[, 2]) &
39 | (x2[, 1] == x2[, 2])
40 | x1 <- matrix(x1[!same_diff_equal, ], ncol = 2, byrow = FALSE)
41 | x2 <- matrix(x2[!same_diff_equal, ], ncol = 2, byrow = FALSE)
42 |
43 | # same score difference
44 | same_diff <- x1[, 1] - x1[, 2] == x2[, 1] - x2[, 2]
45 | x1 <- matrix(x1[!same_diff,], ncol = 2, byrow = FALSE)
46 | x2 <- matrix(x2[!same_diff,], ncol = 2, byrow = FALSE)
47 |
48 | # same winner
49 | same_winner <- sign(x1[, 1] - x1[, 2]) == sign(x2[, 1] - x2[, 2])
50 |
51 | # points
52 | points <- sum(c(same_score*4, same_diff_equal*2, same_diff*3, same_winner*2),
53 | na.rm = TRUE)
54 |
55 | return(points)
56 | }
--------------------------------------------------------------------------------
/WM2018/README.md:
--------------------------------------------------------------------------------
1 | # World Cup predictions
2 |
3 | I compare different predictions for the group stage of the World Cup 2018.
4 | My function are based on the one from Claus Ekstrøm which can be found [here](https://github.com/ekstroem/socceR2018).
5 |
6 | The main result is, taht if you want a good prediction, you should probaly
7 | consider using the ELO ratings.
8 | For more Detail see our blog post about it [here](https://www.statworx.com/de/blog/)
9 |
10 | The plot down below shows the result of 100 siulations with the following
11 | point system:
12 |
13 | | | trend | goal difference | result |
14 | | :-----: | :---: | :-------------: | :----: |
15 | | Victory | 2 | 3 | 4 |
16 | | Draw | 2 | - | 4 |
17 |
18 |
19 | ### Comparison of prediction methods
20 |
21 |
22 |
23 |
24 | ###
25 |
26 |
--------------------------------------------------------------------------------
/WM2018/data/bets2018.csv:
--------------------------------------------------------------------------------
1 | G;;;;;;;;;;;;;
2 | 81;;;;;;;;;;;;;
3 | 81;;;;;;;;;;;;;
4 | 75;;;;;;;;;;;;;
5 | 76;;;;;;;;;;;;;
6 | 77;;;;;;;;;;;;;
7 | 72;;;;;;;;;;;;;
8 | 71;;;;;;;;;;;;;
9 | 66;;;;;;;;;;;;;
10 | 61;;;;;;;;;;;;;
11 | 62;;;;;;;;;;;;;
12 | 62;;;;;;;;;;;;;
13 | 69;;;;;;;;;;;;;
14 | 67;;;;;;;;;;;;;
15 | 61;;;;;;;;;;;;;
16 | 60;;;;;;;;;;;;;
17 | 56;;;;;;;;;;;;;
18 | 64;;;;;;;;;;;;;
19 | 59;;;;;;;;;;;;;
20 | 62;;;;;;;;;;;;;
21 | 66;;;;;;;;;;;;;
22 | 54;;;;;;;;;;;;;
23 | 58;;;;;;;;;;;;;
24 | 65;;;;;;;;;;;;;
25 | 57;;;;;;;;;;;;;
26 | 61;;;;;;;;;;;;;
27 | 60;;;;;;;;;;;;;
28 | 59;;;;;;;;;;;;;
29 | 63;;;;;;;;;;;;;
30 | 62;;;;;;;;;;;;;
31 | 54;;;;;;;;;;;;;
32 | 59;;;;;;;;;;;;;
33 | 54;;;;;;;;;;;;;
34 | 47;;;;;;;;;;;;;
35 | 51;;;;;;;;;;;;;
36 | 58;;;;;;;;;;;;;
37 | 50;;;;;;;;;;;;;
38 | 54;;;;;;;;;;;;;
39 | 53;;;;;;;;;;;;;
40 | 52;;;;;;;;;;;;;
41 | 52;;;;;;;;;;;;;
42 | 38;;;;;;;;;;;;;
43 | 61;;;;;;;;;;;;;
44 | 48;;;;;;;;;;;;;
45 | 50;;;;;;;;;;;;;
46 | 46;;;;;;;;;;;;;
47 | 46;;;;;;;;;;;;;
48 | 48;;;;;;;;;;;;;
49 | 34;;;;;;;;;;;;;
--------------------------------------------------------------------------------
/WM2018/plots/points-for-all-models.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/WM2018/plots/points-for-all-models.png
--------------------------------------------------------------------------------
/WM2018/plots/score-distribution.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/WM2018/plots/score-distribution.png
--------------------------------------------------------------------------------
/airflow/cfg.py:
--------------------------------------------------------------------------------
1 | PROJECT = 'my-first-project-238015'
2 | DATASET = 'waste'
3 |
4 | TABLE_WEIGHT = 'weight'
5 | TABLE_ROUTE = 'route'
6 | TABLE_MERGE = 'merge'
7 |
8 | BQ_TABLE_WEIGHT = '.'.join([DATASET, TABLE_WEIGHT])
9 | BQ_TABLE_ROUTE = '.'.join([PROJECT, DATASET, TABLE_ROUTE])
10 | BQ_TABLE_MERGE = '.'.join([DATASET, TABLE_MERGE])
11 |
12 | BUCKET = 'austin_waste'
13 | FOLDER_DAT = 'data'
14 | FOLDER_RES = 'results'
15 |
16 | SOURCE_OBJECT = FOLDER_DAT + '/' +'route.csv'
17 | DESTINATION_OBJECT = FOLDER_RES + '/' + 'merge.csv'
18 |
19 | BUCKET_URI = 'gs://' + BUCKET + '/'
20 | DESTINATION_URI = BUCKET_URI + DESTINATION_OBJECT
21 |
22 | TYPE = 'DEAD ANIMAL'
--------------------------------------------------------------------------------
/airflow/queries.py:
--------------------------------------------------------------------------------
1 | import cfg
2 |
3 | check_bq_data_exists = """
4 | SELECT load_id
5 | FROM `bigquery-public-data.austin_waste.waste_and_diversion`
6 | WHERE report_date BETWEEN DATE('{{ macros.ds_add(ds, -365) }}') AND DATE('{{ ds }}')
7 | """
8 |
9 | write_weight_data_to_bq = """
10 | SELECT report_date AS date,
11 | load_type AS type,
12 | SUM(load_weight) AS weight
13 | FROM `bigquery-public-data.austin_waste.waste_and_diversion`
14 | WHERE report_date BETWEEN DATE('{{ macros.ds_add(ds, -365) }}') AND DATE('{{ ds }}')
15 | GROUP BY report_date, load_type
16 | HAVING type = '""" + cfg.TYPE + """'
17 | """
18 |
19 | prepare_and_merge_data = """
20 | WITH
21 | simple_route_counts AS (
22 | SELECT report_date,
23 | route_type,
24 | count(route_type) AS count
25 | FROM `my-first-project-238015.waste.route`
26 | GROUP BY report_date, route_type
27 | ),
28 | max_route_counts AS (
29 | SELECT report_date,
30 | FIRST_VALUE(route_type) OVER (PARTITION BY report_date ORDER BY count DESC) AS top_route,
31 | ROW_NUMBER() OVER (PARTITION BY report_date ORDER BY count desc) AS row_number
32 | FROM simple_route_counts
33 | ),
34 | top_routes AS (
35 | SELECT report_date AS date,
36 | top_route,
37 | FROM max_route_counts
38 | WHERE row_number = 1
39 | )
40 | SELECT a.date,
41 | a.type,
42 | a.weight,
43 | b.top_route
44 | FROM `my-first-project-238015.waste.weight` a
45 | LEFT JOIN top_routes b
46 | ON a.date = b.date
47 | ORDER BY a.date DESC
48 | """
--------------------------------------------------------------------------------
/bash_script_collection/.dockerignore:
--------------------------------------------------------------------------------
1 | # git
2 | .git
3 | .gitignore
4 | README.md
5 |
6 | # folders
7 | /some_folder
8 | /tmp/*
9 |
10 | # packrat
11 | # packrat/lib*/
12 | # packrat/src/
13 |
14 | # files
15 | Dockerfile
16 |
17 | # History files
18 | .Rhistory
19 | .Rapp.history
20 | .DS_Store
21 |
22 | # RStudio files
23 | .Rproj.user/
24 | *.Rproj
25 | # !shiny-showcase.Rproj
26 |
27 | # example code
28 | *-Ex.R
29 |
30 | # vignettes
31 | vignettes/*.html
32 | vignettes/*.pdf
33 |
34 | # Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
35 | rsconnect/
36 | .Rproj.user
37 |
38 | # data
39 | .csv
40 | .xlsx
41 | .xlsm
42 | .xls
43 | .RData
44 |
45 | # exceptions
46 |
47 | # utility
48 | git_repair
49 | docker_setup
50 | docker_error_logs
51 | /docker_log_files
--------------------------------------------------------------------------------
/bash_script_collection/.gitignore:
--------------------------------------------------------------------------------
1 | # data
2 | .csv
3 | .xlsx
4 | .xlsm
5 | .xls
6 |
7 | .DS_Store
8 |
9 | # log files
10 | /docker_log_files
11 |
12 | # creator only
13 | /How To Use.docx
14 | .Rproj.user
15 |
--------------------------------------------------------------------------------
/bash_script_collection/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM quantumobject/docker-shiny
2 |
3 | # Install dependencies
4 | RUN apt-get update && apt-get install -y \
5 | libmysqlclient-dev \
6 | libpq-dev \
7 | sudo \
8 | gdebi-core \
9 | pandoc \
10 | pandoc-citeproc \
11 | libcurl4-gnutls-dev \
12 | libxml2-dev \
13 | libcairo2-dev \
14 | libxt-dev \
15 | libssl-dev \
16 | libssh2-1-dev \
17 | libpng-dev \
18 | xtail \
19 | wget
20 |
21 | # Install R packages
22 |
23 | RUN R -e "install.packages(c('dashboard','datasets'),repos = 'http://cran.us.r-project.org')"
24 |
25 | # The test app
26 | COPY testapp /srv/shiny-server/testapp
27 |
28 | # Index html
29 | COPY index_addins /srv/shiny-server/index_addins
30 | COPY index.html /srv/shiny-server/index.html
31 |
32 | # Make port available
33 | EXPOSE 3838
--------------------------------------------------------------------------------
/bash_script_collection/README.md:
--------------------------------------------------------------------------------
1 | # bash_script_collection
2 |
3 | This is a collection of useful bash scripts including an automated docker setup (feel free to use any of them).
4 |
5 | ## How To Use
6 |
7 | How To Use:
8 |
9 | - Download and unzip from github or clone from github.
10 | - Open terminal and navigate to correct folder.
11 | - Execute script bashes with ‘source ./git_repair’, \
12 | ‘source ./docker_setup’ or ‘source ./docker_error_logs’.
13 | - git_repair connects, clones and commits your changes back to github.
14 | - If you downloaded, answer the repository question with ‘y’ !!!
15 | - Note, this is a copy of the original repository and part of the larger blog collection. \
16 | You can therefore only use the git_repair with your own git repositories.
17 | - docker_setup lets you create docker containers (locally as of yet).
18 | The example creates a shiny app.
19 | - docker_error_logs copies and displays error logs if your app failed to load.
20 | - You can almost enter anything for names.
21 | - Pay attention in case of image names and app names!
22 |
23 | Have fun and enjoy
24 |
--------------------------------------------------------------------------------
/bash_script_collection/bash_script_collection.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
--------------------------------------------------------------------------------
/bash_script_collection/docker_error_logs:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This is a script bash for docker log files!
4 | # activate via: chmod 0755 logup_bash or chmod +x logup_bash
5 | # navigate to wd docker_contents
6 | # excute in terminal via source ../logup_bash
7 |
8 | echo ""
9 | echo "Welcome, You are executing a docker error log tool."
10 | echo ""
11 | echo "Do you want to use the Default from the global configurations?"
12 | echo ""
13 | source global_conf.sh
14 | echo $container_name
15 | echo ""
16 | read -p "[Y/n] " y_n
17 | echo ""
18 | if [ $y_n = "Y" ]; then
19 | docker cp $container_name:/var/log/shiny-server/. ./docker_log_files
20 | open ./docker_log_files
21 | else
22 | read -p "What is the name of your docker container? " container_name
23 | echo ""
24 | docker cp $container_name:/var/log/shiny-server/. ./docker_log_files
25 | open ./docker_log_files
26 | fi
27 |
28 | # (created by Stephan Emmer)
--------------------------------------------------------------------------------
/bash_script_collection/git_repair:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This is a script bash for github repositories!
4 | # activate via: chmod 0755 gitup_bash or chmod +x gitup_bash
5 | # excute in terminal via source ../gittup_bash
6 |
7 | echo ""
8 | echo "Welcome, You are executing a shell script bash for github repositotries."
9 | echo ""
10 | read -p "Do you want to check if the local git repository is connected remotely? (y/n) " y_n
11 | echo ""
12 | if [ $y_n == y ]; then
13 | read -p "What is the repository URL you are looking for? " repo
14 | echo ""
15 | if [[ "$(git remote 2> /dev/null)" != "" && -d ".git" ]]; then
16 | echo "The requested git repository has a local clone and is connected."
17 | else
18 | echo "Cloning requested git repository..."
19 | git clone $repo repository_clone # das darf nur wenn noch gar nichts da
20 | mv repository_clone/.git .
21 | rm -rf repository_clone
22 | fi
23 | echo ""
24 | else
25 | echo "No check requested."
26 | echo ""
27 | fi
28 | git pull
29 | git add .
30 | read -p "Enter your commit message: " uservar
31 | echo ""
32 | git commit -a -m "$uservar"
33 | git push
34 |
35 | # (created by Stephan Emmer)
--------------------------------------------------------------------------------
/bash_script_collection/global_conf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Global Configuration
4 | # Define your global settings and default variables here
5 |
6 | # Default Variables Docker
7 |
8 | machine_name="TestMachine"
9 | container_name="testcontainer"
10 | image_name="testimage"
11 | app_name="testapp"
12 | password_name="Test"
13 |
14 | # Default Variables Git
--------------------------------------------------------------------------------
/bash_script_collection/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | STATWORX Tutorials
4 |
5 |
6 |
7 |
8 |
9 | STATWORX Tutorials:
10 |
11 |
12 | Index:
13 |
14 |
15 |
16 | Test App
17 | Test App
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/bash_script_collection/index_addins/Hintergrund2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/bash_script_collection/index_addins/Hintergrund2.png
--------------------------------------------------------------------------------
/bash_script_collection/some_folder/Test Matthias.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf200
2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3 | {\colortbl;\red255\green255\blue255;}
4 | {\*\expandedcolortbl;;}
5 | \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
6 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
7 |
8 | \f0\fs24 \cf0 Test Matthias}
--------------------------------------------------------------------------------
/bash_script_collection/some_folder/TestRobin.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf200
2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3 | {\colortbl;\red255\green255\blue255;}
4 | {\*\expandedcolortbl;;}
5 | \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
6 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
7 |
8 | \f0\fs24 \cf0 Test Matthias}
--------------------------------------------------------------------------------
/bash_script_collection/some_folder/hello_from_the_other_side.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600
2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3 | {\colortbl;\red255\green255\blue255;}
4 | {\*\expandedcolortbl;;}
5 | \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
6 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
7 |
8 | \f0\fs24 \cf0 Hallo Stephan, was ein cooles Tool}
--------------------------------------------------------------------------------
/bash_script_collection/some_folder/some_file:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/bash_script_collection/some_folder/some_file
--------------------------------------------------------------------------------
/bash_script_collection/testapp/server.R:
--------------------------------------------------------------------------------
1 | # Rely on the 'WorldPhones' dataset in the datasets
2 | # package (which generally comes preloaded).
3 | library(datasets)
4 | library(dashboard)
5 |
6 | # Define a server for the Shiny app
7 | function(input, output) {
8 |
9 | # Fill in the spot we created for a plot
10 | output$phonePlot <- renderPlot({
11 |
12 | # Render a barplot
13 | barplot(WorldPhones[,input$region]*1000,
14 | main=input$region,
15 | ylab="Number of Telephones",
16 | xlab="Year")
17 | })
18 | }
19 |
--------------------------------------------------------------------------------
/bash_script_collection/testapp/ui.R:
--------------------------------------------------------------------------------
1 | # Use a fluid Bootstrap layout
2 | fluidPage(
3 |
4 | # Give the page a title
5 | titlePanel("Telephones by region"),
6 |
7 | # Generate a row with a sidebar
8 | sidebarLayout(
9 |
10 | # Define the sidebar with one input
11 | sidebarPanel(
12 | selectInput("region", "Region:",
13 | choices=colnames(WorldPhones)),
14 | hr(),
15 | helpText("Data from AT&T (1961) The World's Telephones.")
16 | ),
17 |
18 | # Create a spot for the barplot
19 | mainPanel(
20 | plotOutput("phonePlot")
21 | )
22 |
23 | )
24 | )
--------------------------------------------------------------------------------
/bash_script_collection/testapp/www/my_style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/bash_script_collection/testapp/www/my_style.css
--------------------------------------------------------------------------------
/bayesian_regularization/.gitignore:
--------------------------------------------------------------------------------
1 | *.tiff
2 | *.png
3 | *.RDS
4 | *.md
--------------------------------------------------------------------------------
/bayesian_regularization/bayesian_updating.R:
--------------------------------------------------------------------------------
1 | rm(list = ls())
2 |
3 | # packages
4 | library(dplyr)
5 | library(ggplot2)
6 |
7 | # prior
8 | alpha <- 1
9 | beta <- 1
10 | n <- 250
11 |
12 | #
13 | k <- seq(0, 1, length.out = 500)
14 | prior <- dbeta(k, alpha, beta)
15 |
16 | posteriors <- data.frame(
17 | x = k,
18 | y = prior,
19 | alpha = alpha,
20 | beta = beta,
21 | n = n,
22 | type = "prior"
23 | )
24 |
25 | for(i in 1:200){
26 |
27 | share <- runif(1, min = 0, max = 0.6)
28 | n <- round(runif(1, min=100, max=500))
29 | r <- round(share*n)
30 |
31 | alpha <- alpha + r
32 | beta <- beta + n - r
33 |
34 | post <- dbeta(k, alpha, beta)
35 |
36 | post <- data.frame(
37 | x = k,
38 | y = post,
39 | alpha = alpha,
40 | beta = beta,
41 | n = n,
42 | type = paste("posterior", i)
43 | )
44 |
45 | posteriors <- rbind(posteriors, post)
46 | }
47 |
48 | p <- posteriors %>%
49 | dplyr::select(x, y, type) %>%
50 | ggplot(aes(x = x, y = y, color = type)) +
51 | geom_line() +
52 | theme_minimal() + labs(x = "", y = "") +
53 | theme(legend.position = "none",
54 | axis.text.y = element_blank(),
55 | axis.text.x = element_blank()) +
56 | scale_color_viridis_d(alpha = 0.2) +
57 | xlim(c(0.15, 0.45))
58 |
59 | tiff("titelbild.png", width = 800, height = 800, res = 100)
60 | p
61 | dev.off()
62 |
--------------------------------------------------------------------------------
/bayesian_regularization/brms_models.R:
--------------------------------------------------------------------------------
1 |
2 | # BRMS model --------------------------------------------------------------
3 |
4 | brms_model <- function(df, priors){
5 |
6 | # run model
7 | my_model <- brms::brm(
8 | formula = price~.,
9 | data = df, family = "normal",
10 | prior = priors,
11 | warmup = 1000, iter = 2000, chains = 4,
12 | control = list(adapt_delta = 0.95)
13 | )
14 |
15 | return(my_model)
16 | }
17 |
18 |
19 | # Summary function --------------------------------------------------------
20 |
21 | brms_summary <- function(model){
22 |
23 | # get summary
24 | post_sum <- brms::posterior_summary(model)
25 |
26 | # wrangle estimates into dataframe
27 | est <- post_sum[,"Estimate"]
28 | est <- est[which(grepl("b_", names(est)))]
29 |
30 | res <- data.frame(
31 | coef = est,
32 | var_name = gsub("b_", "", names(est))
33 | )
34 |
35 | rownames(res) <- NULL
36 |
37 | return(res)
38 | }
39 |
40 | # Get coefficients -----------------------------------------------------------
41 |
42 | brms_get_coef <- function(df, priors, lambdas_inv){
43 |
44 | model <- brms_model(
45 | df = df,
46 | priors = prior_fun(
47 | prior_params = priors,
48 | lambda = lambdas_inv
49 | )
50 | )
51 |
52 | brms_summary(model)
53 | }
54 |
55 | # prior function ----------------------------------------------------------
56 |
57 | prior_fun <- function(prior_params, lambda){
58 | priors <- c(
59 | brms::set_prior(paste0("normal(", prior_params["carat"], "," ,lambda, ")"), coef = "carat"),
60 | brms::set_prior(paste0("normal(", prior_params["depth"], "," ,lambda, ")"), coef = "depth"),
61 | brms::set_prior(paste0("normal(", prior_params["table"], "," ,lambda, ")"), coef = "table"),
62 | brms::set_prior(paste0("normal(", prior_params["x"], "," ,lambda, ")"), coef = "x"),
63 | brms::set_prior(paste0("normal(", prior_params["y"], "," ,lambda, ")"), coef = "y"),
64 | brms::set_prior(paste0("normal(", prior_params["z"], "," ,lambda, ")"), coef = "z")
65 | )
66 |
67 | return(priors)
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/bayesian_regularization/generalized_ridge_ols_comparison.R:
--------------------------------------------------------------------------------
1 |
2 | # Comparison of the Generalized Ridge and OLS estimator -------------------
3 | source("generalized_ridge_point_estimator.R")
4 | library(dplyr)
5 |
6 | # Example using mtcars ----------------------------------------------------
7 | X <- as.matrix(mtcars[,2:ncol(mtcars)])
8 | y <- mtcars[,1]
9 |
10 |
11 | # Set penalty to zero to establish comparison with OLS --------------------
12 | lambda <- 0
13 | mu <- rnorm(ncol(X) + 1) #any random vector for mu will do
14 |
15 |
16 | # Calculate Generalized Ridge Coefficients --------------------------------
17 | gen_ridge_coef <- gen_ridge(
18 | X = X,
19 | y = y,
20 | lambda = lambda,
21 | mu = mu
22 | )
23 |
24 |
25 | # Calculate OLS coefficients ----------------------------------------------
26 | ols_coef <- coef(
27 | lm(
28 | formula = mpg ~ .,
29 | data = mtcars
30 | )
31 | )
32 |
33 |
34 | # Compare the two ---------------------------------------------------------
35 | ols_coef <- data.frame(
36 | coef_ols = ols_coef,
37 | var_name = names(ols_coef)
38 | )
39 |
40 | rownames(ols_coef) <- NULL
41 |
42 | comparison <- dplyr::left_join(
43 | x = gen_ridge_coef,
44 | y = ols_coef,
45 | by = "var_name"
46 | )
47 |
48 | comparison <- comparison %>%
49 | dplyr::mutate(
50 | abs_diff = round(abs(coef - coef_ols), 1)
51 | )
52 |
--------------------------------------------------------------------------------
/bayesian_regularization/generalized_ridge_point_estimator.R:
--------------------------------------------------------------------------------
1 |
2 | # Generalized Ridge Estimator ---------------------------------------------
3 |
4 | gen_ridge <- function(X, y, lambda, mu){
5 |
6 | colnames(X)[1] <- "(Intercept)"
7 |
8 | # define dimensions
9 | n <- nrow(X)
10 | k <- ncol(X)
11 | X_t <- t(X)
12 | mu <- matrix(mu, nrow = k, ncol = 1)
13 |
14 | # diagonal matrix with lambdas
15 | lambda_diag <- diag(
16 | x = lambda,
17 | nrow = k,
18 | ncol = k
19 | )
20 |
21 | # inverted part
22 | first_part <- solve(
23 | X_t %*% X + lambda_diag
24 | )
25 |
26 | # remaining part
27 | second_part <- X_t %*% y + lambda * mu
28 | colnames(second_part) <- "coefficient"
29 |
30 | # Final multiplication
31 | final_res <- first_part %*% second_part
32 |
33 | # return as data.frame
34 | final_res <- data.frame(
35 | var_name = rownames(final_res),
36 | coef = final_res[,'coefficient']
37 | )
38 |
39 | rownames(final_res) <- NULL
40 |
41 | return(final_res)
42 | }
43 |
--------------------------------------------------------------------------------
/bayesian_regularization/rstan_model.stan:
--------------------------------------------------------------------------------
1 | // Data block
2 | data {
3 |
4 | // Dimensions
5 | int n; // n observations
6 | int k; // k variables (with intercept)
7 | int n_1; // number of test samples
8 |
9 | // Observed data
10 | vector[n] y; // vector for prices
11 | matrix[n, k] X; // matrix of predictors (with intercept)
12 | matrix[n_1, k] X_new; // matrix of new feature data
13 |
14 | // Prior information
15 | matrix[k, k] B_0; //matrix of prior variances
16 | vector[k] b_0; // vector of prior means
17 | }
18 |
19 | // Parameters for which we want posterior distributions
20 | parameters {
21 | vector[k] beta; // vector of regression coefficients
22 | real sigma; // variance
23 | }
24 |
25 | // We model only the mean of the posterior, not the variance
26 | transformed parameters {
27 | vector[n] mu;
28 | mu = X * beta;
29 | }
30 |
31 | // The model we want to estimate
32 | model {
33 | beta ~ multi_normal(b_0, sigma*B_0);
34 | y ~ normal(mu, sigma);
35 | }
36 |
37 | // predictions
38 | generated quantities {
39 | vector[n_1] preds;
40 | preds = X_new * beta;
41 | }
42 |
--------------------------------------------------------------------------------
/benzinpreise/README.md:
--------------------------------------------------------------------------------
1 | # code for gas price analysis
2 | This is the code used for the [blogpost about gas prices](https://www.statworx.com/de/blog/6-myths-about-refuelling-tackled-with-statistics/). There, I tackle 6 myths about refuelling with statistics. In a [second blog post](https://www.statworx.com/de/blog/optimising-your-r-code---a-guided-example/) I try to optimise the code and explain the process behind it.
3 |
4 | If you have any questions or found some bugs, just let me know!
--------------------------------------------------------------------------------
/benzinpreise/timeformat-test.R:
--------------------------------------------------------------------------------
1 |
2 | library(data.table)
3 | library(lubridate)
4 | library(microbenchmark)
5 |
6 |
7 | # variables set in station.R
8 | # data from other scripts
9 | DT <- fread(price_files[i.file], select = "date")
10 | DT[, date := substr(date, 1, 19)]
11 | DT[, c("DAY", "TIME") := tstrsplit(date, " ")]
12 |
13 | n <- 10000
14 | DT <- DT[sample(size = n, x = 1:.N, replace = FALSE), ]
15 |
16 |
17 | # with base R
18 | DT[, DATE_baseR := as.POSIXct(date)]
19 |
20 | # with lubridate
21 | DT[, DATE_ymd_hms := ymd_hms(date)]
22 | DT[, DATE_parse_date_time := parse_date_time(date, "Ymd HMS")]
23 |
24 | # with seperate cols and lubridate
25 | DT[, DAY_ymd := ymd(DAY)]
26 | DT[, TIME_hms := as.numeric(hms(TIME))]
27 |
28 | # with data.table
29 | DT[, DATE_IDate := as.IDate(date)]
30 | DT[, DATE_ITime := as.ITime(date)]
31 | DT[, c("DATE_IDate2", "DATE_ITime2") := IDateTime(date)]
32 |
33 | # combination lubridate and data.table
34 | DT[, TIME_hms_ITime := as.ITime(TIME_hms)]
35 |
36 | # with seperate cols and data.table
37 | DT[, DAY_IDate := as.IDate(DAY)]
38 | DT[, TIME_ITime := as.ITime(TIME)]
39 |
40 |
41 | # with unique date and data.table
42 | hour_dt <- unique(DT[, .SD, .SDcol = "date"])
43 | hour_dt[, DATE_ITIME_unique := as.ITime(date)]
44 | hour_dt[, DATE_IDate_unique := as.IDate(date)]
45 | DT <- merge(DT, hour_dt, by = "date", all.x = TRUE)
46 |
47 |
48 | # with unique time and data.table
49 | hour_dt <- unique(DT[, .SD, .SDcol = "TIME"])
50 | hour_dt[, TIME_ITime_unique := as.ITime(TIME)]
51 | DT <- merge(DT, hour_dt, by = "TIME", all.x = TRUE)
52 |
53 |
54 | # rounding with lubridate
55 | minute <- 30
56 | DT[, ROUND_TIME_lb := lubridate::round_date(DATE_ymd_hms, paste0(minute, " mins"))]
57 |
58 | # rounding with plyr
59 | DT[, ROUND_TIME_pl := as.ITime(plyr::round_any(as.numeric(TIME_hms_ITime), minute * 60))]
60 |
61 |
62 |
63 | # benchmark ---------------------------------------------------------------
64 |
65 | # variables set in station.R
66 | DT <- fread(price_files[i.file], select = "date")
67 | DT[, date := substr(date, 1, 19)]
68 | DT[, c("DAY", "TIME") := tstrsplit(date, " ")]
69 |
70 |
71 | # presetting columns
72 | DT[, DAY_ymd := lubridate::ymd(DAY)]
73 | DT[, TIME_hms := as.numeric(lubridate::hms(TIME))]
74 | DT[, DATE_ymd_hms := lubridate::ymd_hms(date)]
75 | DT[, DATE_IDate := as.IDate(date)]
76 | DT[, DATE_ITime := as.ITime(date)]
77 |
78 | microbenchmark(
79 | # lubridate
80 | "lubridate::ymd()" = DT[, DAY_ymd := ymd(DAY)],
81 | "lubridate::hms()" = DT[, TIME_hms := as.numeric(hms(TIME))],
82 | # data.table
83 | "data.table::as.IDate()" = DT[, DATE_IDate := as.IDate(date)],
84 | "data.table::as.ITime()" = DT[, DATE_ITime := as.ITime(date)],
85 | # settings
86 | times = 100L, unit = "ms")
87 |
88 |
89 | minute <- 30
90 | microbenchmark(
91 | # rounding lubridate
92 | "lubridate::round_date()" = DT[, ROUND_TIME_lb := lubridate::round_date(DATE_ymd_hms, paste0(minute, " mins"))],
93 | # rounding plyr
94 | "plyr::round_any()" = DT[, ROUND_TIME_pl := as.ITime(plyr::round_any(as.numeric(DATE_ITime), minute * 60))],
95 | # settings
96 | times = 100L, unit = "ms")
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/blog.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
--------------------------------------------------------------------------------
/bokeh_dashboard/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/bokeh_dashboard/.DS_Store
--------------------------------------------------------------------------------
/bokeh_dashboard/README.md:
--------------------------------------------------------------------------------
1 | # Bokeh Dashboard
2 |
3 | These python scripts show you the different possibilities to create Data Dashboards with bokeh.
4 |
5 | For more information visit our blog at:
6 | https://www.statworx.com/de/blog/data-dashboard-mit-bokeh/
--------------------------------------------------------------------------------
/bokeh_dashboard/bokeh-hist-bar-scatter.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | from seaborn import load_dataset
3 | from bokeh.io import curdoc
4 | from bokeh.layouts import row
5 | from bokeh.models import ColumnDataSource
6 | from bokeh.plotting import figure
7 |
8 | # Festlegen des Dashboard Titles
9 | curdoc().title = "Histogramm/Säulendiagramm und Scatter Plot"
10 |
11 | # Datenset laden
12 | tips = load_dataset("tips")
13 |
14 | # VISUALISIERUNGEN
15 | # Histogramm mit Numpy erstellen
16 | top_hist, x_hist = np.histogram(tips.total_bill)
17 |
18 | # Daten in Dict überführen
19 | source_hist = ColumnDataSource(data=dict(x=x_hist[:-1], top=top_hist))
20 |
21 | # Allgemeinen Plot erstellen
22 | hist = figure(plot_height=400, plot_width=400, title="Histogramm",
23 | x_axis_label='total_bill', y_axis_label='Absolute Häufigkeit')
24 |
25 | # Darstellung des Säulendiagramms
26 | hist.vbar(x='x', top='top', width=0.5, source=source_hist)
27 |
28 | # Kategoriale Variablen
29 | kat_data = tips.smoker.value_counts()
30 | x_kat = list(kat_data.index)
31 | top_kat = kat_data.values
32 |
33 | # Daten in Dict überführen
34 | source_kat = ColumnDataSource(data=dict(x=x_kat, top=top_kat))
35 |
36 | # Allgemeinen Plot erstellen
37 | bar = figure(x_range= x_kat, plot_height=400, plot_width=400, title="Säulendiagramm",
38 | x_axis_label='smoker', y_axis_label='Absolute Häufigkeit')
39 |
40 | # Darstellung des Säulendiagramm
41 | bar.vbar(x='x', top='top', width=0.1, source=source_kat)
42 |
43 | # Allgemeinen Plot erstellen
44 | scatter = figure(plot_height=400, plot_width=400, title="Scatter-Plot",
45 | tools="crosshair,pan,reset,save,wheel_zoom",
46 | x_axis_label='total_bill',
47 | y_axis_label='tip')
48 |
49 | source_scatter = ColumnDataSource(data=dict(x=tips.total_bill, y=tips.tip))
50 | # Darstellung des Scatter Diagramms
51 | scatter.scatter(x='x', y='y', source=source_scatter)
52 |
53 | # Hinzufügen des Scatter Plots in das Hauptdokument
54 | curdoc().add_root(row(hist, bar, scatter))
55 |
--------------------------------------------------------------------------------
/bokeh_dashboard/bokeh-hist-bar.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | from seaborn import load_dataset
3 | from bokeh.io import curdoc
4 | from bokeh.layouts import row
5 | from bokeh.models import ColumnDataSource
6 | from bokeh.plotting import figure
7 |
8 | # Festlegen des Dashboard Titles
9 | curdoc().title = "Histogramm/Säulendiagramm"
10 |
11 | # Datenset laden
12 | tips = load_dataset("tips")
13 |
14 | # VISUALISIERUNGEN
15 | # Histogramm mit Numpy erstellen
16 | top_hist, x_hist = np.histogram(tips.total_bill)
17 |
18 | # Daten in Dict überführen
19 | source_hist = ColumnDataSource(data=dict(x=x_hist[:-1], top=top_hist))
20 |
21 | # Allgemeinen Plot erstellen
22 | hist = figure(plot_height=400, plot_width=400, title="Histogramm",
23 | x_axis_label='total_bill', y_axis_label='Absolute Häufigkeit')
24 |
25 | # Darstellung des Säulendiagramms
26 | hist.vbar(x='x', top='top', width=0.5, source=source_hist)
27 |
28 | # Kategoriale Variablen
29 | kat_data = tips.smoker.value_counts()
30 | x_kat = list(kat_data.index)
31 | top_kat = kat_data.values
32 |
33 | # Daten in Dict überführen
34 | source_kat = ColumnDataSource(data=dict(x=x_kat, top=top_kat))
35 |
36 | # Allgemeinen Plot erstellen
37 | bar = figure(x_range= x_kat, plot_height=400, plot_width=400, title="Säulendiagramm",
38 | x_axis_label='smoker', y_axis_label='Absolute Häufigkeit')
39 |
40 | # Darstellung des Säulendiagramm
41 | bar.vbar(x='x', top='top', width=0.1, source=source_kat)
42 |
43 | # Hinzufügen der beiden Visualisierungen in das Hauptdokument
44 | curdoc().add_root(row(hist, bar))
45 |
--------------------------------------------------------------------------------
/community_detection/lesmis_community_detection.R:
--------------------------------------------------------------------------------
1 | # Libraries --------------------------------------------------------------
2 |
3 | library(igraph)
4 | library(geomnet)
5 |
6 |
7 | # Data Preparation --------------------------------------------------------
8 |
9 | #Load dataset
10 | data(lesmis)
11 |
12 | #Edges
13 | edges <- as.data.frame(lesmis[1])
14 | colnames(edges) <- c("from", "to", "weight")
15 |
16 | #Create graph for the algorithms
17 | g <- graph_from_data_frame(edges, directed = FALSE)
18 |
19 |
20 | # Community Detection -----------------------------------------------------
21 |
22 | # Louvain
23 | lc <- cluster_louvain(g)
24 | membership(lc)
25 | communities(lc)
26 | plot(lc, g)
27 |
28 | # Infomap
29 | imc <- cluster_infomap(g)
30 | membership(imc)
31 | communities(imc)
32 | plot(lc, g)
--------------------------------------------------------------------------------
/compose/bookings/.Rprofile:
--------------------------------------------------------------------------------
1 | source("renv/activate.R")
2 |
--------------------------------------------------------------------------------
/compose/bookings/.dockerignore:
--------------------------------------------------------------------------------
1 | # ignore these files during build
2 | .Rhistory
3 | .Rproj.user
--------------------------------------------------------------------------------
/compose/bookings/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openanalytics/r-base:3.6.1
2 |
3 | RUN mkdir -p root/bookings_api/code
4 | RUN mkdir -p root/bookings_api/data
5 |
6 | COPY code /root/bookings_api/code
7 | #COPY data /root/bookings_api/data
8 |
9 | COPY renv.lock /root/bookings_api/renv.lock
10 | COPY renv /root/bookings_api/renv
11 |
12 | WORKDIR /root/bookings_api
13 |
14 | RUN apt-get update -qq && apt-get install -y \
15 | git-core \
16 | libcurl4-gnutls-dev \
17 | libxml2-dev \
18 | libpq-dev \
19 | sudo \
20 | pandoc \
21 | pandoc-citeproc \
22 | libcurl4-gnutls-dev \
23 | libcairo2-dev \
24 | libxt-dev \
25 | libssl-dev \
26 | libssh2-1-dev \
27 | libssl1.0.0 \
28 | libpng-dev \
29 | xtail \
30 | wget
31 |
32 | RUN R -e "install.packages('renv')"
33 | RUN R -e "library('renv'); renv::consent(provided=TRUE)"
34 | RUN R -e "renv::restore(confirm=FALSE)"
35 | RUN R -e "install.packages('PKI')"
36 |
37 | EXPOSE 6060
38 |
39 | ENTRYPOINT ["R", "-e", "source('code/run.R')"]
40 |
--------------------------------------------------------------------------------
/compose/bookings/Makefile:
--------------------------------------------------------------------------------
1 | IMAGE=bookings-api
2 | VERSION=1.0
3 | CONTAINER=api
4 | TAR_NAME=../tars/bookings_api.tar
5 | NETWORK=smst_network
6 |
7 | build:
8 | @echo 'Building Docker image'
9 | DOCKER_BUILDKIT=1 docker build -t ${IMAGE}:${VERSION} .
10 |
11 | cleanup:
12 | @echo 'Removing untagged images'
13 | @docker rmi $$(docker images -f "dangling=true" -q)
14 |
15 | run:
16 | @echo 'Running Container from API image'
17 | @docker run --rm \
18 | -d \
19 | -v $$(pwd)/data:/root/bookings_api/data \
20 | -p 6060:6060 \
21 | --name ${CONTAINER} \
22 | --net ${NETWORK} \
23 | ${IMAGE}:${VERSION}
24 |
25 | ts:
26 | docker run -it \
27 | -v $$(pwd)/data:/root/bookings/data \
28 | --entrypoint /bin/bash \
29 | --rm \
30 | --name ${CONTAINER}
31 | ${IMAGE}:${VERSION}
32 |
33 | stop:
34 | @echo 'Stopping API'
35 | @docker stop ${CONTAINER}
36 |
37 | stopall:
38 | @echo 'Stopping all containers'
39 | @docker stop $$(docker ps -a -q)
40 |
41 | removeall:
42 | @echo 'Removing all containers'
43 | @docker container rm $$(docker ps -a -q)
44 |
45 | view:
46 | @docker ps -a
47 |
48 | save:
49 | @docker save -o ${TAR_NAME} ${IMAGE}:${VERSION}
50 |
--------------------------------------------------------------------------------
/compose/bookings/code/api.R:
--------------------------------------------------------------------------------
1 | library(dplyr)
2 | library(jsonlite)
3 | library(httr)
4 | library(knitr)
5 | library(ggplot2)
6 | library(kableExtra)
7 | library(forcats)
8 |
9 | # load data
10 | bookings <- read.csv("data/hotel_bookings.csv")
11 |
12 | # get total number of bookings by hotel and country
13 | no_bookings <- bookings %>%
14 | dplyr::filter(is_canceled == 0) %>%
15 | dplyr::group_by(hotel, country) %>%
16 | dplyr::count() %>%
17 | dplyr::ungroup() %>%
18 | dplyr::rename(bookings = n)
19 |
20 | # total revenue table by country
21 | revenue_table <- bookings %>%
22 | dplyr::filter(is_canceled == 0 & country != "NULL") %>%
23 | dplyr::group_by(hotel, market_segment, distribution_channel,
24 | deposit_type, customer_type, country) %>%
25 | dplyr::summarise(revenue = sum(adr, na.rm = TRUE)) %>%
26 | dplyr::ungroup()
27 |
28 | #' Log request information
29 | #' @filter log
30 | function(req){
31 | cat(
32 | "Time of request:", as.character(Sys.time()),"\n",
33 | "Method:", req$REQUEST_METHOD, "\n",
34 | "Path info:", req$PATH_INFO, "\n",
35 | "User agent:", req$HTTP_USER_AGENT, "@", req$REMOTE_ADDR, "\n"
36 | )
37 | plumber::forward()
38 | }
39 |
40 | #' Barchart
41 | #' @png (width=800, height=600)
42 | #' @param min_bookings
43 | #' @param my_country
44 | #' @get /plot
45 | function(req, res, min_bookings, my_country){
46 |
47 | # throw error
48 | if(missing(min_bookings)){
49 | stop(message("min_bookings is missing"))
50 | }
51 |
52 | # cast input to numeric
53 | if(!is.numeric(min_bookings)){
54 | min_bookings <- as.numeric(min_bookings)
55 | }
56 |
57 | # generate barchart
58 | p1 <- no_bookings %>%
59 | dplyr::filter(bookings >= min_bookings) %>%
60 | ggplot2::ggplot(
61 | mapping = aes(
62 | x = forcats::fct_reorder(country, bookings),
63 | y = bookings,
64 | fill = hotel
65 | )
66 | ) +
67 | ggplot2::geom_bar(stat="identity", position = "dodge") +
68 | ggplot2::coord_flip() +
69 | ggplot2::theme_minimal() +
70 | ggplot2::labs(
71 | y = "Number of bookings",
72 | x = "Country",
73 | fill = "Hotel type",
74 | title = paste("Countries with at least ", min_bookings, "bookings")
75 | )
76 |
77 | # use print to render plot
78 | print(p1)
79 | }
80 |
81 |
82 | #' Filter revenue table
83 | #' @serializer html
84 | #' @param mycountry
85 | #' @get /revenue
86 | #' @post /revenue
87 | function(req, res, mycountry){
88 |
89 | # throw error
90 | if(missing(mycountry)){
91 | stop(message("country is missing"))
92 | }
93 |
94 | # render html table
95 | revenue_table %>%
96 | dplyr::filter(country == mycountry) %>%
97 | knitr::kable(format = "html")
98 | }
99 |
--------------------------------------------------------------------------------
/compose/bookings/code/run.R:
--------------------------------------------------------------------------------
1 | library(plumber)
2 |
3 | # create api
4 | hotel_api <- plumber::plumb("code/api.R")
5 |
6 | # run api
7 | hotel_api$run(host = "0.0.0.0", port = 6060)
--------------------------------------------------------------------------------
/compose/bookings/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 |
4 | api:
5 | image: bookings-api:1.0
6 | volumes:
7 | - ./data:/root/bookings_api/data
8 | restart: unless-stopped
9 | nginx:
10 | image: mynginx
11 | ports:
12 | - "443:443"
13 | - "80:80"
14 | depends_on:
15 | - api
16 | restart: unless-stopped
17 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/BH:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/BH/1.72.0-3/8f9ce74c6417d61f0782cbae5fd2b7b0/BH
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/DBI:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/DBI/1.1.0/4744be45519d675af66c28478720fce5/DBI
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/DT:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/DT/0.13/a16cb2832248c7cff5a6f505e2aea45b/DT
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/ISOcodes:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/ISOcodes/2020.03.16/d1e1eff9b4e4ac815a244e8dd9a34ceb/ISOcodes
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/MASS:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/MASS/7.3-51.5/9efe80472b21189ebab1b74169808c26/MASS
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/Matrix:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/Matrix/1.2-18/08588806cba69f04797dab50627428ed/Matrix
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/NLP:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/NLP/0.2-0/87cc6e9aa4c81e4c0f2d1df89d3561a8/NLP
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/PKI:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/PKI/0.1-7/4f0e5ce5d2fbd87cbc1371731ed29c66/PKI
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/R6:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/R6/2.4.1/292b54f8f4b94669b08f94e5acce6be2/R6
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/RColorBrewer:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/RColorBrewer/1.1-2/e031418365a7f7a766181ab5a41a5716/RColorBrewer
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/RPostgres:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/RPostgres/1.2.0/15d7e33de3686143734a81e3fcce5199/RPostgres
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/Rcpp:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/Rcpp/1.0.3/f3ca785924863b0e4c8cb23b6a5c75a1/Rcpp
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/RcppArmadillo:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/RcppArmadillo/0.9.870.2.0/f7fee4557377d47093bd2b65f2642e52/RcppArmadillo
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/SQUAREM:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/SQUAREM/2020.2/274007cf21ffabcbc2e5f0bf73abcb3d/SQUAREM
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/SnowballC:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/SnowballC/0.7.0/bc26e07c0d747fd287c370fe355e7b85/SnowballC
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/TTR:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/TTR/0.23-6/fa1289136d3861f34dd0af6f7e9d7ac9/TTR
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/anomalize:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/anomalize/0.2.0/54020c7967b7422bc4ba0c53f04f8964/anomalize
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/askpass:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/askpass/1.1/e8a22846fff485f0be3770c2da758713/askpass
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/assertthat:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/assertthat/0.2.1/50c838a310445e954bc13f26f26a6ecf/assertthat
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/backports:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/backports/1.1.7/e9c8188eb82b137301493492d767a1ac/backports
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/base64enc:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/base64enc/0.1-3/543776ae6848fde2f48ff3816d0628bc/base64enc
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/bit:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/bit/1.1-15.2/eb6c52d8cc44463085a4cde1c63df163/bit
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/bit64:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/bit64/0.9-7/3338d4a9b1352f5a613e2bdcefe784ea/bit64
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/blob:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/blob/1.2.1/9addc7e2c5954eca5719928131fed98c/blob
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/broom:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/broom/0.5.6/754fdb4d17d4ae871343ff2909728ca3/broom
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/callr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/callr/3.4.3/643163a00cb536454c624883a10ae0bc/callr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/cli:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/cli/2.0.2/ff0becff7bfdfe3f75d29aff8f3172dd/cli
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/clipr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/clipr/0.7.0/08cf4045c149a0f0eaf405324c7495bd/clipr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/colorspace:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/colorspace/1.4-1/6b436e95723d1f0e861224dd9b094dfb/colorspace
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/crayon:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/crayon/1.3.4/0d57bc8e27b7ba9e45dba825ebc0de6b/crayon
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/crosstalk:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/crosstalk/1.1.0.1/ae55f5d7c02f0ab43c58dd050694f2b4/crosstalk
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/curl:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/curl/4.3/2b7d10581cc730804e9ed178c8374bd6/curl
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/data.table:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/data.table/1.12.8/cd711af60c47207a776213a368626369/data.table
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/desc:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/desc/1.2.0/6c8fe8fa26a23b79949375d372c7b395/desc
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/digest:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/digest/0.6.25/f697db7d92b7028c4b3436e9603fb636/digest
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/dplyr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/dplyr/0.8.4/3ecb1deedd4c4ad6ebf4605d263616f2/dplyr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/dtt:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/dtt/0.1-2/c6d92416317cf258f8cc48631d81d68e/dtt
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/ellipsis:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/ellipsis/0.3.0/7067d90c1c780bfe80c0d497e3d7b49d/ellipsis
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/evaluate:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/evaluate/0.14/ec8ca05cffcc70569eaaad8469d2a3a7/evaluate
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/fansi:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/fansi/0.4.1/7fce217eaaf8016e72065e85c73027b5/fansi
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/farver:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/farver/2.0.3/dad6793a5a1f73c8e91f1a1e3e834b05/farver
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/forcats:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/forcats/0.5.0/1cb4279e697650f0bd78cd3601ee7576/forcats
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/forecast:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/forecast/8.12/2d5f55dfe5ea54017d2840f49f5d3cf8/forecast
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/fracdiff:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/fracdiff/1.5-1/90dcf1296b82b2f79d9c5aa081081e43/fracdiff
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/fs:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/fs/1.4.1/780713bd2f53156fae001443dcdbdcd5/fs
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/furrr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/furrr/0.1.0/c1f60eafdbcbea57078aa6f501974d2a/furrr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/future:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/future/1.17.0/71c119f236429d7b19fd29229b013cba/future
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/generics:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/generics/0.0.2/b8cff1d1391fd1ad8b65877f4c7f2e53/generics
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/ggplot2:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/ggplot2/3.2.1/9ac60f09a2f437af8df8638ef3da0288/ggplot2
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/gh:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/gh/1.1.0/89ea5998938d1ad55f035c8a86f96b74/gh
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/git2r:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/git2r/0.27.1/531a82d1beed1f545beb25f4f5945bf7/git2r
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/globals:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/globals/0.12.5/e9e529fb7a579ad4b4ff65e052e76ed8/globals
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/glue:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/glue/1.3.1/d4e25697c450c01b202c79ef35694a83/glue
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/gower:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/gower/0.2.1/1e7e711f2f87cc3a326f7f406815d019/gower
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/gtable:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/gtable/0.3.0/ac5c6baf7822ce8732b343f14c072c4d/gtable
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/hexbin:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/hexbin/1.28.1/3d59212f2814d65dff517e6899813c58/hexbin
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/highr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/highr/0.8/4dc5bb88961e347a0f4d8aad597cbfac/highr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/hms:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/hms/0.5.3/726671f634529d470545f9fd1a9d1869/hms
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/htmltools:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/htmltools/0.4.0/2d7691222f82f41e93f6d30f169bd5e1/htmltools
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/htmlwidgets:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/htmlwidgets/1.5.1/41bace23583fbc25089edae324de2dc3/htmlwidgets
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/httpuv:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/httpuv/1.5.2/f793dad2c9ae14fbb1d22f16f23f8326/httpuv
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/httr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/httr/1.4.1/7146fea4685b4252ebf478978c75f597/httr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/hunspell:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/hunspell/3.0/71e7853d60b6b4ba891d62ede21752e9/hunspell
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/igraph:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/igraph/1.2.5/3878c30ce67cdb7f2d7f72554e37f476/igraph
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/ini:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/ini/0.3.1/6154ec2223172bce8162d4153cda21f7/ini
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/ipred:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/ipred/0.9-9/816a7f746179f159f8faa87af730f3c1/ipred
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/janeaustenr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/janeaustenr/0.1.5/8b07a4b9d0a0d97d9fe12de8af6d219e/janeaustenr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/jsonlite:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/jsonlite/1.6.1/84b0ee361e2f78d6b7d670db9471c0c5/jsonlite
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/kableExtra:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/kableExtra/1.1.0/37e11c605b3c0b7207763beda52c8535/kableExtra
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/knitr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/knitr/1.28/915a6f0134cdbdf016d7778bc80b2eda/knitr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/labeling:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/labeling/0.3/73832978c1de350df58108c745ed0e3e/labeling
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/later:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/later/1.0.0/6d927978fc658d24175ce37db635f9e5/later
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/lattice:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/lattice/0.20-40/61339152c288b871facca5f68f401f89/lattice
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/lava:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/lava/1.6.7/e9a046d514942f36bf8ae2a5e3ded35f/lava
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/lazyeval:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/lazyeval/0.2.2/d908914ae53b04d4c0c0fd72ecc35370/lazyeval
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/lifecycle:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/lifecycle/0.1.0/dc0e9c03b3635ff433b045ce6bf0612d/lifecycle
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/listenv:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/listenv/0.8.0/0bde42ee282efb18c7c4e63822f5b4f7/listenv
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/lmtest:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/lmtest/0.9-37/c108129ded5ffdb129064ec1d7ba77d0/lmtest
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/lubridate:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/lubridate/1.7.8/6c04c31012c1be39783bebbbfc27b3a3/lubridate
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/magrittr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/magrittr/1.5/1bb58822a20301cee84a41678e25d9b7/magrittr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/markdown:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/markdown/1.1/61e4a10781dd00d7d81dd06ca9b94e95/markdown
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/mgcv:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/mgcv/1.8-31/4bb7e0c4f3557583e1e8d3c9ffb8ba5c/mgcv
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/mime:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/mime/0.9/e87a35ec73b157552814869f45a63aa3/mime
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/munsell:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/munsell/0.5.0/6dfe8bf774944bd5595785e3229d8771/munsell
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/nlme:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/nlme/3.1-144/e80d41932d3cc235ccbbbb9732ae162e/nlme
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/numDeriv:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/numDeriv/2016.8-1.1/df58958f293b166e4ab885ebcad90e02/numDeriv
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/odbc:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/odbc/1.2.2/e76003d15ae8638ccde579dc69bb76e1/odbc
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/openssl:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/openssl/1.4.1/49f7258fd86ebeaea1df24d9ded00478/openssl
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/padr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/padr/0.5.2/c1abbac68a8c1c8b634c19f491610ab7/padr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/pillar:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/pillar/1.4.3/fa3ed60396b6998d0427c57dab90fba4/pillar
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/pkgconfig:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/pkgconfig/2.0.3/01f28d4278f15c76cddbea05899c5d6f/pkgconfig
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/plogr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/plogr/0.2.0/09eb987710984fc2905c7129c7d85e65/plogr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/plotly:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/plotly/4.9.2.1/b08edf378e0e38959a6983e3d5902795/plotly
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/plumber:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/plumber/0.4.6/be585bfab152779520e8f9ac86b122b9/plumber
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/plyr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/plyr/1.8.5/3f1b0dbcc503320e6e7aae6c3ff87eaa/plyr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/prettyunits:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/prettyunits/1.1.1/95ef9167b75dde9d2ccc3c7528393e7e/prettyunits
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/processx:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/processx/3.4.2/20a082f2bde0ffcd8755779fd476a274/processx
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/prodlim:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/prodlim/2019.11.13/c243bf70db3a6631a0c8783152fb7db9/prodlim
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/progress:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/progress/1.2.2/14dc9f7a3c91ebb14ec5bb9208a07061/progress
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/promises:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/promises/1.1.0/efbbe62da4709f7040a380c702bc7103/promises
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/ps:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/ps/1.3.3/425d938eb9c02906a8ac98c0c2a306b5/ps
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/purrr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/purrr/0.3.3/22aca7d1181718e927d403a8c2d69d62/purrr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/quadprog:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/quadprog/1.5-8/5f919ae5e7f83a6f91dcf2288943370d/quadprog
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/quantmod:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/quantmod/0.4.17/4de4156e52cd66215066d28c0577a56e/quantmod
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/readr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/readr/1.3.1/af8ab99cd936773a148963905736907b/readr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/recipes:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/recipes/0.1.12/332b6f1a6fc9b165b419b3638d4fdadb/recipes
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rematch2:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rematch2/2.1.2/76c9e04c712a05848ae7a23d2f170a40/rematch2
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: renv
2 | Type: Package
3 | Title: Project Environments
4 | Version: 0.9.3
5 | Authors@R: c(
6 | person("Kevin", "Ushey", role = c("aut", "cre"), email = "kevin@rstudio.com"),
7 | person("RStudio", role = c("cph"))
8 | )
9 | Description: A dependency management toolkit for R. Using 'renv', you can create
10 | and manage project-local R libraries, save the state of these libraries to
11 | a 'lockfile', and later restore your library as required. Together, these
12 | tools can help make your projects more isolated, portable, and reproducible.
13 | License: MIT + file LICENSE
14 | URL: https://rstudio.github.io/renv
15 | BugReports: https://github.com/rstudio/renv/issues
16 | Imports: utils
17 | Suggests: covr, knitr, packrat, remotes, reticulate, rmarkdown,
18 | rstudioapi, testthat
19 | Encoding: UTF-8
20 | LazyData: true
21 | RoxygenNote: 7.0.2
22 | VignetteBuilder: knitr
23 | NeedsCompilation: no
24 | Packaged: 2020-02-10 21:40:07 UTC; kevinushey
25 | Author: Kevin Ushey [aut, cre],
26 | RStudio [cph]
27 | Maintainer: Kevin Ushey
28 | Repository: CRAN
29 | Date/Publication: 2020-02-10 22:40:05 UTC
30 | Built: R 3.6.2; ; 2020-02-27 12:54:20 UTC; unix
31 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/INDEX:
--------------------------------------------------------------------------------
1 | activate Activate a Project
2 | bootstrap Bootstrap an renv Installation
3 | clean Clean a Project
4 | config User-Level Configuration of renv
5 | consent Consent to usage of renv
6 | deactivate Deactivate a Project
7 | dependencies Find R Package Dependencies in a Project
8 | diagnostics Print a Diagnostics Report
9 | equip Install Required System Libraries
10 | history View Lockfile History
11 | hydrate Hydrate a Project
12 | init Initialize a Project
13 | install Install Packages
14 | isolate Isolate a Project
15 | load Load a Project
16 | lockfile Programmatically Create and Modify a Lockfile
17 | lockfiles Lockfiles
18 | migrate Migrate a Project from Packrat to renv
19 | modify Open the Lockfile for Editing
20 | paths Path Customization
21 | project Retrieve the Active Project
22 | purge Purge Packages from the Cache
23 | rebuild Rebuild the Packages in your Project Library
24 | record Update Package Records in a Lockfile
25 | refresh Refresh the Local Cache of Available Packages
26 | rehash Re-Hash Packages in the renv Cache
27 | remote Resolve a Remote
28 | remove Remove Packages
29 | renv-package Project-local Environments for R
30 | restore Restore a Project
31 | revert Revert Lockfile
32 | run Run a Script
33 | scaffold Generate renv Project Infrastructure
34 | settings Project Settings
35 | snapshot Snapshot a Project
36 | status Status
37 | update Update Packages
38 | upgrade Upgrade renv
39 | use_python Use Python
40 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2019
2 | COPYRIGHT HOLDER: RStudio
3 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/Rd.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/Rd.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/features.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/features.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/hsearch.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/hsearch.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/links.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/links.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/nsInfo.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/nsInfo.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/package.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/package.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/vignette.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/Meta/vignette.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | S3method(print,renv_lockfile_api)
4 | S3method(print,renv_updates)
5 | S3method(renv_lockfile_resolve,default)
6 | S3method(renv_lockfile_resolve,renv_lockfile_api)
7 | S3method(str,renv_lockfile_api)
8 | export(activate)
9 | export(clean)
10 | export(consent)
11 | export(deactivate)
12 | export(dependencies)
13 | export(diagnostics)
14 | export(equip)
15 | export(history)
16 | export(hydrate)
17 | export(init)
18 | export(install)
19 | export(isolate)
20 | export(load)
21 | export(migrate)
22 | export(modify)
23 | export(paths)
24 | export(project)
25 | export(purge)
26 | export(rebuild)
27 | export(record)
28 | export(refresh)
29 | export(rehash)
30 | export(remove)
31 | export(restore)
32 | export(revert)
33 | export(run)
34 | export(scaffold)
35 | export(settings)
36 | export(snapshot)
37 | export(status)
38 | export(update)
39 | export(upgrade)
40 | export(use_python)
41 | importFrom(utils,URLencode)
42 | importFrom(utils,available.packages)
43 | importFrom(utils,contrib.url)
44 | importFrom(utils,download.file)
45 | importFrom(utils,file.edit)
46 | importFrom(utils,head)
47 | importFrom(utils,install.packages)
48 | importFrom(utils,installed.packages)
49 | importFrom(utils,old.packages)
50 | importFrom(utils,packageDescription)
51 | importFrom(utils,packageVersion)
52 | importFrom(utils,read.table)
53 | importFrom(utils,remove.packages)
54 | importFrom(utils,sessionInfo)
55 | importFrom(utils,str)
56 | importFrom(utils,tail)
57 | importFrom(utils,tar)
58 | importFrom(utils,untar)
59 | importFrom(utils,unzip)
60 | importFrom(utils,update.packages)
61 | importFrom(utils,zip)
62 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/R/renv:
--------------------------------------------------------------------------------
1 | # File share/R/nspackloader.R
2 | # Part of the R package, http://www.R-project.org
3 | #
4 | # Copyright (C) 1995-2012 The R Core Team
5 | #
6 | # This program is free software; you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation; either version 2 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # A copy of the GNU General Public License is available at
17 | # http://www.r-project.org/Licenses/
18 |
19 | local({
20 | info <- loadingNamespaceInfo()
21 | pkg <- info$pkgname
22 | ns <- .getNamespace(as.name(pkg))
23 | if (is.null(ns))
24 | stop("cannot find namespace environment for ", pkg, domain = NA);
25 | dbbase <- file.path(info$libname, pkg, "R", pkg)
26 | lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.")
27 | })
28 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/R/renv.rdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/R/renv.rdb
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/R/renv.rdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/R/renv.rdx
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/ci.R:
--------------------------------------------------------------------------------
1 | ## ---- include = FALSE---------------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>"
5 | )
6 |
7 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/collaborating.R:
--------------------------------------------------------------------------------
1 | ## ---- include = FALSE---------------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>",
5 | eval = FALSE
6 | )
7 |
8 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/docker.R:
--------------------------------------------------------------------------------
1 | ## ---- include = FALSE---------------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>"
5 | )
6 |
7 | ## -----------------------------------------------------------------------------
8 | Sys.setenv(RENV_PATHS_CACHE = "~/path/to/cache")
9 | renv:::renv_paths_cache()
10 |
11 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/faq.R:
--------------------------------------------------------------------------------
1 | ## ---- include = FALSE---------------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>"
5 | )
6 |
7 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/local-sources.R:
--------------------------------------------------------------------------------
1 | ## ---- include = FALSE---------------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>",
5 | eval = FALSE
6 | )
7 |
8 | ## -----------------------------------------------------------------------------
9 | # renv:::renv_paths_local()
10 |
11 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/local-sources.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Local Sources"
3 | output: rmarkdown::html_vignette
4 | vignette: >
5 | %\VignetteIndexEntry{Local Sources}
6 | %\VignetteEngine{knitr::rmarkdown}
7 | %\VignetteEncoding{UTF-8}
8 | ---
9 |
10 | ```{r, include = FALSE}
11 | knitr::opts_chunk$set(
12 | collapse = TRUE,
13 | comment = "#>",
14 | eval = FALSE
15 | )
16 | ```
17 |
18 |
19 | If your project depends on R packages not available in any external source, you
20 | can set up an ad-hoc local source to use during restore. This allows you to
21 | provide package tarballs that can be used to restore packages otherwise not
22 | available elsewhere.
23 |
24 | The environment variable `RENV_PATHS_LOCAL` can be used to customize where this
25 | local source of packages should live. It should point to a directory containing
26 | package binaries and sources, with a structure of the form:
27 |
28 | - `${RENV_PATHS_LOCAL}/_.tar.gz`; or
29 | - `${RENV_PATHS_LOCAL}//_.tar.gz`
30 |
31 | Alternatively, you can also use project-specific local sources by placing your
32 | packages within a folder located at `renv/local`. Note that this folder does
33 | not exist by default; you must create it to opt-in to this mechanism.
34 |
35 | - `/renv/local/_.tar.gz`; or
36 | - `/renv/local//_.tar.gz`
37 |
38 | As an example, if your project depended on a package `skeleton 1.0.0`, you could
39 | place a tarball for this package in one of the following locations:
40 |
41 | - `${RENV_PATHS_LOCAL}/skeleton_1.0.0.tar.gz`
42 | - `${RENV_PATHS_LOCAL}/skeleton/skeleton_1.0.0.tar.gz`
43 | - `/renv/local/_.tar.gz`; or
44 | - `/renv/local//_.tar.gz`
45 |
46 | Once this is done, `renv` will consult these directories during future attempts
47 | to restore packages installed from unknown sources.
48 |
49 | Note that packages placed in one of these local sources will override any
50 | default source recorded in the lockfile. For example, if `skeleton 1.0.0` was
51 | also available on CRAN, `renv::restore()` would still use the locally-provided
52 | tarball rather than the version available from CRAN.
53 |
54 | If you want to see what directory is being used by `renv` for local package
55 | sources, you can execute:
56 |
57 | ```{r}
58 | renv:::renv_paths_local()
59 | ```
60 |
61 | See `?paths` for more details.
62 |
63 |
64 | ## Explicit Sources
65 |
66 | You can also provide explicit source paths in the lockfile if desired. This is
67 | most useful if you are building an `renv` lockfile "by hand", or need to tweak
68 | an existing lockfile to point at a separate package for installation. For
69 | example, you could have a package record in `renv.lock` of the form:
70 |
71 | ```
72 | {
73 | "Package": "skeleton",
74 | "Version": "1.0.1",
75 | "Source": "/mnt/r/pkg/skeleton_1.0.1.tar.gz"
76 | }
77 | ```
78 |
79 | The main requirement is that your source path exists, and the path has an
80 | extension of either `.tar.gz`, (for source packages), `.tgz` (for macOS
81 | binaries) or `.zip` (for Windows binaries).
82 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/lockfile.R:
--------------------------------------------------------------------------------
1 | ## ----setup, include = FALSE---------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>"
5 | )
6 |
7 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/lockfile.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Lockfiles"
3 | output: rmarkdown::html_vignette
4 | vignette: >
5 | %\VignetteIndexEntry{Lockfiles}
6 | %\VignetteEngine{knitr::rmarkdown}
7 | %\VignetteEncoding{UTF-8}
8 | ---
9 |
10 | ```{r setup, include = FALSE}
11 | knitr::opts_chunk$set(
12 | collapse = TRUE,
13 | comment = "#>"
14 | )
15 | ```
16 |
17 | `renv` uses a **lockfile** to capture the state of your \R library at some point
18 | in time. It is stored as a collection of *records*, with different records
19 | defining:
20 |
21 | - The version of `renv` used when generating the lockfile;
22 | - The version of `R` used in that project;
23 | - The R repositories that were active when the lockfile was created;
24 | - *Package records* defining each R package, their version, and their
25 | installation source.
26 |
27 | Here is an example lockfile, including the packages `markdown` and `mime`:
28 |
29 | ```
30 | {
31 | "renv": {
32 | "Version": "`r renv:::renv_package_version("renv")`"
33 | },
34 | "R": {
35 | "Version": "`r getRversion()`",
36 | "Repositories": [
37 | {
38 | "Name": "CRAN",
39 | "URL": "https://cloud.r-project.org"
40 | }
41 | ]
42 | },
43 | "Packages": {
44 | "markdown": {
45 | "Package": "markdown",
46 | "Version": "1.0",
47 | "Source": "Repository",
48 | "Repository": "CRAN",
49 | "Hash": "4584a57f565dd7987d59dda3a02cfb41"
50 | },
51 | "mime": {
52 | "Package": "mime",
53 | "Version": "0.7",
54 | "Source": "Repository",
55 | "Repository": "CRAN",
56 | "Hash": "908d95ccbfd1dd274073ef07a7c93934"
57 | }
58 | }
59 | }
60 | ```
61 |
62 | The function `renv::snapshot()` is used to create this lockfile, and by default
63 | writes these records to the file `renv.lock`. Later, if you need to re-install
64 | the specific package versions as recorded in `renv.lock`, you can use
65 | `renv::restore()`.
66 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/packages.R:
--------------------------------------------------------------------------------
1 | ## ---- include = FALSE---------------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>",
5 | eval = FALSE
6 | )
7 |
8 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/python.R:
--------------------------------------------------------------------------------
1 | ## ---- include = FALSE---------------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>"
5 | )
6 |
7 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/python.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Using Python with renv"
3 | output: rmarkdown::html_vignette
4 | vignette: >
5 | %\VignetteIndexEntry{Using Python with renv}
6 | %\VignetteEngine{knitr::rmarkdown}
7 | %\VignetteEncoding{UTF-8}
8 | ---
9 |
10 | ```{r, include = FALSE}
11 | knitr::opts_chunk$set(
12 | collapse = TRUE,
13 | comment = "#>"
14 | )
15 | ```
16 |
17 | If you're using `renv` with an R project that also depends on some Python
18 | packages (say, through the [reticulate](https://rstudio.github.io/reticulate/)
19 | package), then you may find `renv`'s Python integration useful.
20 |
21 |
22 | ## Activating Python Integration
23 |
24 | Python integration can be activated on a project-by-project basis. Use
25 | `renv::use_python()` to tell `renv` to create and use a project-local Python
26 | environment with your project. If the `reticulate` package is installed and
27 | active, then `renv` will use the same version of Python that `reticulate`
28 | normally would when generating the virtual environment. Alternatively, you can
29 | set the `RETICULATE_PYTHON` environment variable to instruct `renv` to use a
30 | different version of Python.
31 |
32 | If you'd rather tell `renv` to use an existing Python virtual environment, you
33 | can do so by passing the path of that virtual environment instead -- use
34 | `renv::use_python(python = "/path/to/python")` and `renv` will record and
35 | use that Python interpreter with your project. This can also be used with
36 | pre-existing virtual environments and Conda environments.
37 |
38 |
39 | ## Understanding Python Integration
40 |
41 | Once Python integration is active, `renv` will attempt to manage the state of
42 | your Python virtual environment when `snapshot()` / `restore()` is called. With
43 | this, projects that use `renv` and Python can ensure that Python dependencies
44 | are tracked in addition to R package dependencies. Note that future restores
45 | will require both `renv.lock` (for R package dependencies) and
46 | `requirements.txt` (for Python package dependencies).
47 |
48 |
49 | ### Virtual Environments
50 |
51 | When using virtual environments, the following extensions are provided:
52 |
53 | - `renv::snapshot()` calls `pip freeze > requirements.txt` to save the
54 | set of installed Python packages;
55 |
56 | - `renv::restore()` calls `pip install -r requirements.txt` to install
57 | the previously-recorded set of Python packages.
58 |
59 |
60 | ### Conda Environments
61 |
62 | When using Conda environments, the following extensions are provided:
63 |
64 | - `renv::snapshot()` calls `conda env export > environment.yml` to save the
65 | set of installed Python packages;
66 |
67 | - `renv::restore()` calls `conda env [create/update] --file environment.yml` to
68 | install the previously-recorded set of Python packages.
69 |
70 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/doc/renv.R:
--------------------------------------------------------------------------------
1 | ## ----setup, include = FALSE---------------------------------------------------
2 | knitr::opts_chunk$set(
3 | collapse = TRUE,
4 | comment = "#>",
5 | eval = FALSE
6 | )
7 |
8 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/AnIndex:
--------------------------------------------------------------------------------
1 | renv-package renv-package
2 | activate activate
3 | bootstrap bootstrap
4 | clean clean
5 | config config
6 | consent consent
7 | deactivate deactivate
8 | dependencies dependencies
9 | diagnostics diagnostics
10 | equip equip
11 | history history
12 | hydrate hydrate
13 | init init
14 | install install
15 | isolate isolate
16 | load load
17 | lockfile lockfile
18 | lockfiles lockfiles
19 | migrate migrate
20 | modify modify
21 | paths paths
22 | project project
23 | purge purge
24 | rebuild rebuild
25 | record record
26 | refresh refresh
27 | rehash rehash
28 | remote remote
29 | remove remove
30 | renv renv-package
31 | restore restore
32 | revert revert
33 | run run
34 | scaffold scaffold
35 | settings settings
36 | snapshot snapshot
37 | status status
38 | update update
39 | upgrade upgrade
40 | use_python use_python
41 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/aliases.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/aliases.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/paths.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/paths.rds
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/renv.rdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/renv.rdb
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/renv.rdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/help/renv.rdx
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/html/R.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: white;
3 | color: black;
4 | }
5 |
6 | a:link {
7 | background: white;
8 | color: blue;
9 | }
10 |
11 | a:visited {
12 | background: white;
13 | color: rgb(50%, 0%, 50%);
14 | }
15 |
16 | h1 {
17 | background: white;
18 | color: rgb(55%, 55%, 55%);
19 | font-family: monospace;
20 | font-size: x-large;
21 | text-align: center;
22 | }
23 |
24 | h2 {
25 | background: white;
26 | color: rgb(40%, 40%, 40%);
27 | font-family: monospace;
28 | font-size: large;
29 | text-align: center;
30 | }
31 |
32 | h3 {
33 | background: white;
34 | color: rgb(40%, 40%, 40%);
35 | font-family: monospace;
36 | font-size: large;
37 | }
38 |
39 | h4 {
40 | background: white;
41 | color: rgb(40%, 40%, 40%);
42 | font-family: monospace;
43 | font-style: italic;
44 | font-size: large;
45 | }
46 |
47 | h5 {
48 | background: white;
49 | color: rgb(40%, 40%, 40%);
50 | font-family: monospace;
51 | }
52 |
53 | h6 {
54 | background: white;
55 | color: rgb(40%, 40%, 40%);
56 | font-family: monospace;
57 | font-style: italic;
58 | }
59 |
60 | img.toplogo {
61 | width: 4em;
62 | vertical-align: middle;
63 | }
64 |
65 | img.arrow {
66 | width: 30px;
67 | height: 30px;
68 | border: 0;
69 | }
70 |
71 | span.acronym {
72 | font-size: small;
73 | }
74 |
75 | span.env {
76 | font-family: monospace;
77 | }
78 |
79 | span.file {
80 | font-family: monospace;
81 | }
82 |
83 | span.option{
84 | font-family: monospace;
85 | }
86 |
87 | span.pkg {
88 | font-weight: bold;
89 | }
90 |
91 | span.samp{
92 | font-family: monospace;
93 | }
94 |
95 | div.vignettes a:hover {
96 | background: rgb(85%, 85%, 85%);
97 | }
98 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/resources/WELCOME:
--------------------------------------------------------------------------------
1 |
2 | Welcome to renv! It looks like this is your first time using renv.
3 | This is a one-time message, briefly describing some of renv's functionality.
4 |
5 | This package maintains a local cache of data on the filesystem at:
6 |
7 | - ${RENV_PATHS_ROOT}
8 |
9 | This path can be customized -- see the documentation in `?paths`.
10 |
11 | renv will also write to files within the active project folder, including:
12 |
13 | - A folder 'renv' in the project directory, and
14 | - A lockfile called 'renv.lock' in the project directory.
15 |
16 | In particular, projects using renv will normally use a private, per-project
17 | R library, in which new packages will be installed. This project library is
18 | isolated from other R libraries on your system.
19 |
20 | In addition, renv will attempt to update files within your project, including:
21 |
22 | - .gitignore
23 | - .Rbuildignore
24 | - .Rprofile
25 |
26 | Please read the introduction vignette with `vignette("renv")` for more information.
27 | You can also browse the package documentation online at http://rstudio.github.io/renv.
28 |
29 | By providing consent, you will allow renv to write and update these files.
30 |
31 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/resources/scripts-git-askpass.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | case "$1" in
4 | Username*) echo "${GIT_USERNAME:-${GIT_USER}}" ;;
5 | Password*) echo "${GIT_PASSWORD:-${GIT_PASS}}" ;;
6 | esac
7 |
8 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/renv/resources/scripts-repos-cache.R:
--------------------------------------------------------------------------------
1 |
2 | args <- commandArgs(TRUE)
3 |
4 | input <- args[[1]]
5 | output <- args[[2]]
6 |
7 | data <- readRDS(input)
8 | unlink(input)
9 |
10 | for (type in data$type) {
11 |
12 | urls <- contrib.url(data$repos, type)
13 | for (url in urls) {
14 |
15 | db <- withCallingHandlers(
16 | tryCatch(available.packages(contriburl = url), error = identity),
17 | warning = function(w) invokeRestart("muffleWarning"),
18 | message = function(m) invokeRestart("muffleMessage")
19 | )
20 |
21 | if (inherits(db, "error"))
22 | next
23 |
24 | # save to tempfile
25 | tmpfile <- tempfile(pattern = "renv-cache-", tmpdir = output)
26 | on.exit(unlink(tmpfile), add = TRUE)
27 | saveRDS(db, file = tmpfile)
28 |
29 | # rename from tempfile to cache file
30 | name <- sprintf("repos_%s.rds.cache", URLencode(url, reserved = TRUE))
31 | path <- file.path(output, name)
32 | file.rename(tmpfile, path)
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/reshape2:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/reshape2/1.4.3/15a23ad30f51789188e439599559815c/reshape2
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rjson:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rjson/0.2.20/7d597f982ee6263716b6a2f28efd29fa/rjson
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rlang:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rlang/0.4.5/1cc1b38e4db40ea6eb19ab8080bbed3b/rlang
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rmarkdown:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rmarkdown/2.1/9d1c61d476c448350c482d6664e1b28b/rmarkdown
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rprojroot:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rprojroot/1.3-2/f6a407ae5dd21f6f80a6708bbb6eb3ae/rprojroot
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rsample:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rsample/0.0.6/b98117693cf327f50dc07fcbc85e2de6/rsample
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rstudioapi:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rstudioapi/0.11/33a5b27a03da82ac4b1d43268f80088a/rstudioapi
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rtweet:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rtweet/0.7.0/81f40170e8dc7216f18830f303a0f954/rtweet
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/rvest:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/rvest/0.3.5/6a20c2cdf133ebc7ac45888c9ccc052b/rvest
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/scales:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/scales/1.1.0/a1c68369c629ea3188d0676e37069c65/scales
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/selectr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/selectr/0.4-2/3838071b66e0c566d55cc26bd6e27bf4/selectr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/slam:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/slam/0.1-47/73c92e0f6f2a29786505152040c35825/slam
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/slider:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/slider/0.1.3/c96d72f16b2ae17c2ccef1f9e576081e/slider
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/stopwords:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/stopwords/2.0/74a57875d6cac219b8a3d897e7c03bcc/stopwords
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/stringi:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/stringi/1.4.6/e99d8d656980d2dd416a962ae55aec90/stringi
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/stringr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/stringr/1.4.0/0759e6b6c0957edb1311028a49a35e76/stringr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/sweep:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/sweep/0.2.2/1fa475517213a9c40fb295bf3568c741/sweep
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/sys:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/sys/3.3/507f3116a38d37ad330a038b3be07b66/sys
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/syuzhet:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/syuzhet/1.0.4/f470cbfba10bf6d0f62722c5561a3341/syuzhet
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/textshape:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/textshape/1.7.1/d87f0855e8cf57a3bd2506f7e5aa4459/textshape
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tibble:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tibble/2.1.3/8248ee35d1e15d1e506f05f5a5d46a75/tibble
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tibbletime:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tibbletime/0.1.3/fe1ecdf8bd5bf0d4e951859cf92119e7/tibbletime
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tidyr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tidyr/1.0.3/df860e8e4e1a1b454f18537c8bc96211/tidyr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tidyselect:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tidyselect/1.0.0/7d4b0f1ab542d8cb7a40c593a4de2f36/tidyselect
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tidytext:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tidytext/0.2.4/3c8a4339c705bf331ed4f45f36cb2344/tidytext
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/timeDate:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/timeDate/3043.102/fde4fc571f5f61978652c229d4713845/timeDate
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/timetk:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/timetk/1.0.0/9621034665b427d137344123b9581492/timetk
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tinytex:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tinytex/0.22/8b0712f45a05c8e79ce7ba06b249583c/tinytex
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tm:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tm/0.7-7/ea7232b98cd08d481a5bf452fa9b51f3/tm
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tokenizers:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tokenizers/0.2.1/a064f646b3a692e62dfb5d9ea690a4ea/tokenizers
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/tseries:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/tseries/0.10-47/35ddfebb7e520955418f9dde02ca345d/tseries
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/twitteR:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/twitteR/1.1.9/9dee48cd46b77db5a9136612b47b6262/twitteR
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/urca:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/urca/1.3-0/7e54e92d0362b977e26dd5a5a3a263a1/urca
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/usethis:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/usethis/1.6.1/e1985f5a9985fea2e338fa7eb99018ca/usethis
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/utf8:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/utf8/1.1.4/4a5081acfb7b81a572e4384a7aaf2af1/utf8
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/vctrs:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/vctrs/0.2.3/2c0f41d87be7a186139a6d3d5215848e/vctrs
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/viridisLite:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/viridisLite/0.3.0/ce4f6271baa94776db692f1cb2055bee/viridisLite
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/warp:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/warp/0.1.0/5c786a8883c9f49f6d137ee76558ceef/warp
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/webshot:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/webshot/0.5.2/e99d80ad34457a4853674e89d5e806de/webshot
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/whisker:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/whisker/0.4/ca970b96d894e90397ed20637a0c1bbe/whisker
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/withr:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/withr/2.1.2/aa57ed55ff2df4bea697a07df528993d/withr
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/wordcloud:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/wordcloud/2.6/dddb6538141ed1e2435cb63c6c748d16/wordcloud
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/xfun:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/xfun/0.13/3c1eeacd705ff1695db94bfd443b8a84/xfun
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/xml2:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/xml2/1.3.2/d4d71a75dd3ea9eb5fa28cc21f9585e2/xml2
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/xts:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/xts/0.12-0/cae1f4b14c523f62b61276fb3962d4fb/xts
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/yaml:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/yaml/2.2.1/2826c5d9efb0a88f657c7a679c7106db/yaml
--------------------------------------------------------------------------------
/compose/bookings/renv/library/R-3.6/x86_64-apple-darwin15.6.0/zoo:
--------------------------------------------------------------------------------
1 | /Users/thomasalcock/Library/Application Support/renv/cache/v5/R-3.6/x86_64-apple-darwin15.6.0/zoo/1.8-8/c2ea03282caa1f6972dc84fc5bf671cc/zoo
--------------------------------------------------------------------------------
/compose/bookings/renv/settings.dcf:
--------------------------------------------------------------------------------
1 | external.libraries:
2 | ignored.packages:
3 | package.dependency.fields: Imports, Depends, LinkingTo
4 | snapshot.type: packrat
5 | use.cache: TRUE
6 | vcs.ignore.library: TRUE
7 |
--------------------------------------------------------------------------------
/compose/bookings/startup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | echo ""
3 | echo "This program deploys the Hotel Bookings API Backend to a previously created Docker-Machine VM of your choice"
4 | echo ""
5 | #check if docker-machine is installed
6 | docker-machine --version
7 | if [[ $? -ne 0 ]]; then
8 | echo "Please install docker-machine."
9 | exit 1
10 | fi
11 | echo ""
12 | echo "The following virtual machines are available:"
13 | echo ""
14 | docker-machine ls
15 | echo ""
16 | n=0
17 | until [[ $n -gt 2 ]];
18 | do
19 | # get user input
20 | echo "Enter name of VM:"
21 | echo ""
22 | read VM_NAME
23 | echo ""
24 | docker-machine ls -q | grep -w $VM_NAME
25 | if [ $? -ne 0 ]; then
26 | echo "VM not found, try again."
27 | n=$(($n+1))
28 | else
29 | docker-machine start $VM_NAME && break
30 | fi
31 | done
32 | echo ""
33 | echo "IP Address:"
34 | docker-machine ip $VM_NAME
35 | echo ""
36 | echo "Setting environment variables"
37 | eval $(docker-machine env $VM_NAME)
38 | echo ""
39 | echo "Available docker images:"
40 | docker images
41 | echo ""
42 | echo "Starting application stack ..."
43 | docker-compose up -d --scale api=3
44 | echo ""
45 | echo "Active containers:"
46 | docker ps -a
47 | echo ""
48 | echo "Press any button to shut down the application stack"
49 | read SHUTDOWN_STACK
50 | if [ $? -eq 0 ]; then
51 | docker-compose down
52 | fi
53 | echo ""
54 | echo "Press any button to shut down the VM"
55 | read SHUTDOWN_VM
56 | if [ $? -eq 0 ]; then
57 | docker-machine stop $VM_NAME
58 | fi
--------------------------------------------------------------------------------
/compose/lb/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:1.17.8
2 | COPY default.conf /etc/nginx/conf.d/default.conf
3 | COPY ssl /etc/nginx/ssl
--------------------------------------------------------------------------------
/compose/lb/Makefile:
--------------------------------------------------------------------------------
1 | IMAGE=mynginx
2 | NETWORK=smst_network
3 |
4 | build:
5 | DOCKER_BUILDKIT=1 docker build -t ${IMAGE} .
6 |
7 | save:
8 | docker save -o ../tars/mynginx.tar ${IMAGE}
9 |
10 | run:
11 | docker run -p 80:80 \
12 | -d \
13 | --rm \
14 | --name test \
15 | --net ${NETWORK} \
16 | ${IMAGE}
17 |
18 | runit:
19 | docker run -p 80:80 \
20 | -it \
21 | --rm \
22 | --name test \
23 | --net ${NETWORK} \
24 | ${IMAGE} \
25 | /bin/bash
26 |
27 | cleanup:
28 | docker rmi $$(docker images -f "dangling=true" -q)
29 |
30 | certs:
31 | sudo openssl req -x509 \
32 | -nodes -days 365 \
33 | -newkey rsa:2048 \
34 | -keyout $$(pwd)/ssl/private/nginx-selfsigned.key \
35 | -out $$(pwd)/ssl/certs/nginx-selfsigned.crt
36 |
37 | siege:
38 | siege -d1 -c10 -t1S -log http://localhost:80/bookings/plot?min_bookings=1000
39 |
--------------------------------------------------------------------------------
/compose/lb/default.conf:
--------------------------------------------------------------------------------
1 | log_format upstream_log '$server_name to: $upstream_addr[$request] '
2 | 'upstream_response_time $upstream_response_time'
3 | 'msec $msec request_time $request_time';
4 |
5 | server {
6 | listen 80 default_server;
7 | server_name _;
8 | return 301 https://192.168.99.101$request_uri;
9 | }
10 |
11 | server {
12 | listen 443 ssl;
13 | server_name 192.168.99.101;
14 |
15 | access_log /var/log/nginx/access.log upstream_log;
16 |
17 | ssl_certificate /etc/nginx/ssl/certs/nginx-selfsigned.crt;
18 | ssl_certificate_key /etc/nginx/ssl/private/nginx-selfsigned.key;
19 |
20 | location / {
21 | proxy_pass http://api:6060;
22 | proxy_http_version 1.1;
23 | proxy_set_header Host $host;
24 | proxy_set_header X-Forwarded-Host $server_name;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/compose/lb/ssl/certs/cert.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIFazCCA1OgAwIBAgIUbfgXDuAzVHGm/WfHFYwQ06Wib0EwDQYJKoZIhvcNAQEL
3 | BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
4 | GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMDA1MjgxMTQxNTBaFw0yMTA1
5 | MjgxMTQxNTBaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
6 | HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggIiMA0GCSqGSIb3DQEB
7 | AQUAA4ICDwAwggIKAoICAQCayd2XUJIlbRJOtVeUzViKk2xKHvr3OxHmKgQ7m2xt
8 | dX8nRjKyMCj3xQndLLcX6aYU04a5w7dpT1+dlonImhW0KQG4taECA2qAGAxOEvYW
9 | 4JxCApBluMie9Wa/waw7dpvmWGBafi8vrOgyuc6y6Zo/fvCt0CZzd17Y3jMK3bmy
10 | XuL9tZC/7hkvR72OxLcMBMo2F8lbdlAMhafGL+Jy3+YuvXEnFlIB3KGVCryS3AwC
11 | DecsOI5eAt+7JN/aaDfaTpDoURrjQMSlbK7UW7ptyDkNyTFz6afWHHeO/EO4DGSX
12 | p51LIYwCfgfkDy1eGqX1vH0Ms1yHh3l29Jk8QJZ42tQuPQlzZgPHWf5m+gnLMjVn
13 | RllviOka8RCiUx8/YyFkth8h0ne3EVBoXL+FDtFcFbfoCDRvdnEzcEyJZlri3mos
14 | s7p6Hw0x1Ox9vIiTXSfTmknZa8tPWj/WRRB0F0oK1TdhjBYY3A2OEx2pDpXKA0yB
15 | Ro6HY+V33AIr8X67eKjsfnpTdi37o4pou6cDZa08J+1V87ATdpoqMs6V+BeI9+gp
16 | xx9SavcZK1AWSUmPpybaILlwKenOKNJNDOxrzY6rkQsEi65PTbpIziGKxOG5TKJv
17 | LIdtpSOLRgMOCn4g8n+gIbjwpCK8p+YvHSEVn9IQqVkhg2R51K7PQr1+9YO/kVuw
18 | uwIDAQABo1MwUTAdBgNVHQ4EFgQUdEFIhKRuj8JaTo8RSq+55y5lTbgwHwYDVR0j
19 | BBgwFoAUdEFIhKRuj8JaTo8RSq+55y5lTbgwDwYDVR0TAQH/BAUwAwEB/zANBgkq
20 | hkiG9w0BAQsFAAOCAgEAlc+Z9zxEEvkwWS6y+OEIrEEP3Q8M/JFGWcAgT3i6WMgx
21 | wofE3b5572k00d8w5Lh9jEB/XiWxYIZaEq0yJ1hC/Fd2W+1v3Tpi+cPsybNm1jwO
22 | fQTmCP/5wOmB+rfaxrSweDMCHKT6iUmjdwbmSsjn7R4P1o3OSWkZMN9QqrRaD8cA
23 | 8i8+k7NkvZSveFB6aavg0WAtdrxxGMBEgTOdDW6AvIC9hQBQkYEdoI+KhBN8Yc5m
24 | O1V4QZ0SwvRNL8+D0DBRzeBLtunu6yBpGXBzaAh/3nsYPw6gYWZHjpyfTpZ6zbm2
25 | 5WTW7wK469Zu5ALcL8GTGUC1rddEIJJho4mnqLNYSUsyBxTwkZoMXeaCM+6guawC
26 | s8nNU+Zh/gPuXC71/MPgWEnsU3iMjm1OKgJnwkVML0+Vvwrc/zCF7msSkeXcrI/c
27 | nAmoTZmjcjjGaYRWl4Q1Z9KogOWFjsDxkJnVWJg9KQVpBLAOhsnKg4HyPbOJLJrY
28 | D39RW2L5yj1xLWH2/mv7XDfKrjYLXKjzXytS/P4Jr2yE//XGFCwZ644Gr3uljJ0l
29 | ZDfTPZl7aC63qlJrgFWhd0fjXB5CocToN2Ob9UYdp5ZOnSHOnI860rtpCKWVtzWM
30 | kH3QfX8Tj7Jyc5Tr+VA6fNeTfC7PAW8IgGs2a2rIFEHQvl+qAY0Wq5alCRiSHPU=
31 | -----END CERTIFICATE-----
32 |
--------------------------------------------------------------------------------
/compose/lb/ssl/certs/nginx-selfsigned.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDazCCAlOgAwIBAgIUUyXO2FtmMGjCf/XuNmfr8gfIdRcwDQYJKoZIhvcNAQEL
3 | BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
4 | GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMDA2MjQxNDQ4MjJaFw0yMTA2
5 | MjQxNDQ4MjJaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
6 | HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
7 | AQUAA4IBDwAwggEKAoIBAQCt8je2FA0sNynEdEdlHROBUAyMrICLrPLqJ0N4nCd1
8 | eYryG1UZVjCt/atPJBN8Un1n3A/KCO419h3eV7EVK6vShiMGJkDr1hmQGquvVxZA
9 | wKwkIzdIjdZVNj8v9W5FUGfuecUJA4AkQ+JQpTBhy1yaiYfTRH3Isd0rmfif7Scz
10 | Nb4AhVmlOkmex3O5q2JqrlSUSQKjvvMvyVQR68BVbGKKgLcmLocEPGsAX8ct4hmE
11 | gngg9ml+goeEF6fg8SpUku18djKwSn/Beu58cubHIlGEo78Z6xLjr1E4QpTkP8Pw
12 | v/sgE3CoCh7fB3QhvqrbUOSO+sfi3wXtkj0Zh/aKb8cHAgMBAAGjUzBRMB0GA1Ud
13 | DgQWBBTjMv71Zoj1vi4BLm+Ydp2PXhElUTAfBgNVHSMEGDAWgBTjMv71Zoj1vi4B
14 | Lm+Ydp2PXhElUTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAR
15 | 0JExaWCOo/Z/NTsHGOrdfQl7/ykRYvIoL8tuNEBM5wW3BtIli4PKzvvOn60Rjxp6
16 | tvuN0FCLQTxR9b06CUpbQx+85mPSePfluEbdovz5ldJzl/GK7XBOlDvYkZyqH3gX
17 | 0Dn2igOrZ24bhatzPnAaZr9p++KNJTiuqEtxeyKwOtMV/0HwO1Ah/jvmdAqEjUlL
18 | dP7xX4TgM5owtVOUdrCDViba72kqA0kgGp63P8QvJmUdQMEA3FLDVnkWHnIiFphv
19 | UVkg7Q4nbRBkmuFHr5wStLm8okyy3KYTazhPj9yFhoWNj9bJPMtKx0YlbIlWU3T1
20 | TyBhps3ssTENZopLOVbu
21 | -----END CERTIFICATE-----
22 |
--------------------------------------------------------------------------------
/compose/lb/ssl/private/nginx-selfsigned.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCt8je2FA0sNynE
3 | dEdlHROBUAyMrICLrPLqJ0N4nCd1eYryG1UZVjCt/atPJBN8Un1n3A/KCO419h3e
4 | V7EVK6vShiMGJkDr1hmQGquvVxZAwKwkIzdIjdZVNj8v9W5FUGfuecUJA4AkQ+JQ
5 | pTBhy1yaiYfTRH3Isd0rmfif7SczNb4AhVmlOkmex3O5q2JqrlSUSQKjvvMvyVQR
6 | 68BVbGKKgLcmLocEPGsAX8ct4hmEgngg9ml+goeEF6fg8SpUku18djKwSn/Beu58
7 | cubHIlGEo78Z6xLjr1E4QpTkP8Pwv/sgE3CoCh7fB3QhvqrbUOSO+sfi3wXtkj0Z
8 | h/aKb8cHAgMBAAECggEAP1d51BL/LP+1dPWG3ho1dRxqRXu3n6VOG9hKaIwsjknB
9 | QCKV3ZEWTvWVwU74zYfYZM6s7TxNSlciT0oNkREDE7mG3YFmmLqxOlmL9WC4GMJQ
10 | rSQpyIDl8Me9QMCV9CWwgxXSm1KsAgi6S/WrZaFBSoEUdel2CHREftElyU75vFqW
11 | vjC1pht3zxQfZgk25w4NPg5KpeYch1QpxM0T/tVSRyFOuMFKKZPco9hlAGjZf0nr
12 | /kfZ6X7PjD0iZArlr0uHY2IUP9KBcIGYL/xvV6HriQgUdIzORt55YfhRByFtaivg
13 | TT46/k+PTdVT4i/0JJghisCalNN6l0/U3aPwWqYVaQKBgQDeOnVDdgABPnkM60+A
14 | Csc8WaK0beHldcHg9/URGDl9VQiyQA/4iayd5f+9KB3xhJHQh1ek7lFQ/GKBatT5
15 | khKELNnM25FGZUuOc93L5kwnA+oAMN+22iEtGXPlYVMH0V7dCrli2ECPZ06DuniI
16 | lm/iRUzSVM2zkfVb/iNRnM/BewKBgQDIYWVQf5qXNr1mR10bma3JrJCQpsSPLOss
17 | FAtAGPWnV2RebQLnOYYMScnEI1/Wmgzq1bQtRs0Qsgdw6mYEQxg77QvSuMsEcZMI
18 | RQh964STGjYx+57pTgSFicqAiHc5snyFGrLnOIfXFnFyVYiCUBMy+pv0qPWpu0hO
19 | Qox+wVbc5QKBgQC8ZAZg6Dnc1B8+qoU84OZB7SMXnkdwhMGVe98PXN/vthSnN9PS
20 | OLRTL1X7/3RS+LW8d9/+++GHrE29tNlTsVdtIbCKEGE5skm5O9R9NIC+Wn0XKFee
21 | 5ZBWcUtk23rOF9o5vQuoFfe1GjjfR0dDU3UJ9wHHFQlE/6lnESzT1QHy3QKBgH0l
22 | ryQmfgOBEatmWLVbNtolJ6jgLxUIxdwirKActpgMEciTpuOI3rqf/x67xSh/0B9+
23 | 1ugMNxj9R35zNsHksacDtoWmGk2tLVpV2ybhyEwja8Ot1iL6MgLA+zNph6UGX5S2
24 | BxQ4D0b7YmE5IGfa4RLOyEZ2m++k41TVZW/pCnotAoGBAJJdj05pRJ+HoBJsmmgU
25 | xcky1BfFIiEtcWtf0eUW/IqVOXyQK45Mnojxa85lcd2SposAQG7lThBzKv85yrPZ
26 | 08FXZiU8BfAUX8+YCIizipbjOR+UnwaAbNQC2IQFZwzZcbs7eQMyfXj+nCYGq1nP
27 | OO2GZ75c5QiYEu0qDmdJHwHj
28 | -----END PRIVATE KEY-----
29 |
--------------------------------------------------------------------------------
/cross-validation/README.md:
--------------------------------------------------------------------------------
1 | # Code for building cross-validation from scratch in R
2 |
3 | This is the code I used in my [blog post](https://www.statworx.com/de/blog/evaluating-model-performance-by-building-cross-validation-from-scratch/) on evaluating model performance by building cross-validation from scratch in R.
4 |
--------------------------------------------------------------------------------
/cross-validation/cv_from_scratch.R:
--------------------------------------------------------------------------------
1 | ## Building Cross-Validation From Scratch in R
2 |
3 | rm(list = ls())
4 |
5 | ## Install and load required packages
6 | # devtools::install_github("andrebleier/Xy")
7 | library(tidyverse)
8 | library(Xy)
9 |
10 | ## Simulate data
11 | sim <- Xy(n = 1000,
12 | numvars = c(2,2),
13 | catvars = 0,
14 | cor = c(-0.5, 0.9),
15 | noisevars = 0)
16 |
17 | sim_data <- sim$data
18 |
19 | ## Define error metric
20 | RMSE <- function(f, o){
21 | sqrt(mean((f - o)^2))
22 | }
23 |
24 | ## Define k
25 | k <- 5
26 |
27 | ## Partition the data
28 | set.seed(12345)
29 | sim_data <- mutate(sim_data,
30 | my.folds = sample(1:k,
31 | size = nrow(sim_data),
32 | replace = TRUE))
33 |
34 | ## Train and validate the model
35 | cv.fun <- function(this.fold, data){
36 |
37 | train <- filter(data, my.folds != this.fold)
38 | validate <- filter(data, my.folds == this.fold)
39 |
40 | model <- lm(y ~ NLIN_1 + NLIN_2 + LIN_1 + LIN_2,
41 | data = train)
42 |
43 | pred <- predict(model, newdata = validate) %>% as.vector()
44 |
45 | this.rmse <- RMSE(f = pred, o = validate$y)
46 |
47 | return(this.rmse)
48 | }
49 |
50 | ## Iterate through each fold
51 | cv.error <- sapply(seq_len(k),
52 | FUN = cv.fun,
53 | data = sim_data) %>%
54 | mean()
55 |
56 | ## Return the cross-validation error
57 | cv.error
58 |
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt1/code/dynamic_boxes.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(shinydashboard)
3 |
4 | ui <- dashboardPage(
5 | dashboardHeader(),
6 |
7 | dashboardSidebar(
8 | selectizeInput(
9 | inputId = "select",
10 | label = "Select countries:",
11 | choices = c("CH", "JP", "GER"),
12 | multiple = TRUE)
13 | ),
14 |
15 | dashboardBody(column(2, uiOutput("ui1"), offset = 6),
16 | column(2, uiOutput("ui2")),
17 | column(2, uiOutput("ui3")))
18 | )
19 |
20 | server <- function(input, output) {
21 |
22 | output$ui1 <- renderUI({
23 | req(input$select)
24 |
25 | lapply(seq_along(input$select), function(i) {
26 | fluidRow(
27 | valueBox(value = input$select[i],
28 | subtitle = "Box 1",
29 | width = 12)
30 | )
31 | })
32 | })
33 |
34 | output$ui2 <- renderUI({
35 | req(input$select)
36 |
37 | lapply(seq_along(input$select), function(i) {
38 | fluidRow(
39 | valueBox(value = input$select[i],
40 | subtitle = "Box 2",
41 | width = 12)
42 | )
43 | })
44 | })
45 |
46 | output$ui3 <- renderUI({
47 | req(input$select)
48 |
49 | lapply(seq_along(input$select), function(i) {
50 | fluidRow(
51 | valueBox(value = input$select[i],
52 | subtitle = "Box 3",
53 | width = 12)
54 | )
55 | })
56 | })
57 | }
58 |
59 | shinyApp(ui = ui, server = server)
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt1/code/dynamic_tabs.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(shinydashboard)
3 | library(glue)
4 |
5 | ui <- dashboardPage(
6 | dashboardHeader(),
7 |
8 | dashboardSidebar(
9 | sliderInput(inputId = "slider", label = NULL, min = 1, max = 5, value = 3, step = 1)
10 | ),
11 |
12 | dashboardBody(
13 | fluidRow(
14 | box(width = 12,
15 | p(mainPanel(width = 12,
16 | column(width = 6, uiOutput("reference")),
17 | column(width = 6, uiOutput("comparison"))
18 | )
19 | )
20 | )
21 | )
22 | )
23 | )
24 |
25 | server <- function(input, output) {
26 |
27 | output$reference <- renderUI({
28 | tabsetPanel(
29 | tabPanel(
30 | "Reference",
31 | h3("Reference Content"))
32 | )
33 | })
34 |
35 | output$comparison <- renderUI({
36 | req(input$slider)
37 |
38 | myTabs <- lapply(1:input$slider, function(i) {
39 |
40 | tabPanel(title = glue("Tab {i}"),
41 | h3(glue("Content {i}"))
42 | )
43 | })
44 | do.call(tabsetPanel, myTabs)
45 | })
46 | }
47 |
48 | shinyApp(ui = ui, server = server)
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt1/code/static_boxes.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(shinydashboard)
3 |
4 | ui <- dashboardPage(
5 |
6 | dashboardHeader(),
7 | dashboardSidebar(),
8 |
9 | dashboardBody(column(width = 4,
10 | fluidRow(valueBoxOutput("ch_1", width = 12)),
11 | fluidRow(valueBoxOutput("jp_1", width = 12)),
12 | fluidRow(valueBoxOutput("ger_1", width = 12))),
13 | column(width = 4,
14 | fluidRow(valueBoxOutput("ch_2", width = 12)),
15 | fluidRow(valueBoxOutput("jp_2", width = 12)),
16 | fluidRow(valueBoxOutput("ger_2", width = 12))),
17 | column(width = 4,
18 | fluidRow(valueBoxOutput("ch_3", width = 12)),
19 | fluidRow(valueBoxOutput("jp_3", width = 12)),
20 | fluidRow(valueBoxOutput("ger_3", width = 12)))
21 | )
22 | )
23 |
24 | server <- function(input, output) {
25 |
26 | output$ch_1 <- renderValueBox({
27 | valueBox(value = "CH",
28 | subtitle = "Box 1")
29 | })
30 |
31 | output$ch_2 <- renderValueBox({
32 | valueBox(value = "CH",
33 | subtitle = "Box 2")
34 | })
35 |
36 | output$ch_3 <- renderValueBox({
37 | valueBox(value = "CH",
38 | subtitle = "Box 3",
39 | width = 12)
40 | })
41 |
42 | output$jp_1 <- renderValueBox({
43 | valueBox(value = "JP",
44 | subtitle = "Box 1",
45 | width = 12)
46 | })
47 |
48 | output$jp_2 <- renderValueBox({
49 | valueBox(value = "JP",
50 | subtitle = "Box 2",
51 | width = 12)
52 | })
53 |
54 | output$jp_3 <- renderValueBox({
55 | valueBox(value = "JP",
56 | subtitle = "Box 3",
57 | width = 12)
58 | })
59 |
60 | output$ger_1 <- renderValueBox({
61 | valueBox(value = "GER",
62 | subtitle = "Box 1",
63 | width = 12)
64 | })
65 |
66 | output$ger_2 <- renderValueBox({
67 | valueBox(value = "GER",
68 | subtitle = "Box 2",
69 | width = 12)
70 | })
71 |
72 | output$ger_3 <- renderValueBox({
73 | valueBox(value = "GER",
74 | subtitle = "Box 3",
75 | width = 12)
76 | })
77 | }
78 |
79 | shinyApp(ui = ui, server = server)
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt1/images/Bildschirmfoto 2019-08-14 um 09.44.53.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/dynamic-shinyUI-pt1/images/Bildschirmfoto 2019-08-14 um 09.44.53.png
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt1/images/Bildschirmfoto 2019-08-14 um 09.45.46.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/dynamic-shinyUI-pt1/images/Bildschirmfoto 2019-08-14 um 09.45.46.png
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt2/code/example1.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(shinydashboard)
3 |
4 | ui <- dashboardPage(
5 |
6 | dashboardHeader(),
7 | dashboardSidebar(
8 | selectInput(inputId = "select",
9 | label = "please select an option",
10 | choices = LETTERS[1:3]),
11 | uiOutput("conditional_comment")
12 | ),
13 | dashboardBody(
14 | uiOutput("selection_text"),
15 | uiOutput("comment_text")
16 | )
17 | )
18 |
19 | server <- function(input, output) {
20 |
21 | output$selection_text <- renderUI({
22 |
23 | paste("The selected option is", input$select)
24 | })
25 |
26 | output$conditional_comment <- renderUI({
27 | req(input$select == "B")
28 |
29 | textAreaInput(inputId = "comment",
30 | label = "please add a comment",
31 | placeholder = "write comment here")
32 |
33 | })
34 |
35 | output$comment_text <- renderText({
36 |
37 | input$comment
38 | })
39 | }
40 |
41 | shinyApp(ui = ui, server = server)
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt2/code/example2.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(shinydashboard)
3 |
4 | ui <- dashboardPage(
5 |
6 | dashboardHeader(),
7 | dashboardSidebar(
8 | selectInput(inputId = "select",
9 | label = "please select an option",
10 | choices = LETTERS[1:3]),
11 | conditionalPanel(
12 | condition = "input.select == 'B'",
13 | textAreaInput(inputId = "comment",
14 | label = "please add a comment",
15 | placeholder = "write comment here")
16 | )
17 | ),
18 | dashboardBody(
19 | uiOutput("selection_text"),
20 | textOutput("comment_text")
21 | )
22 | )
23 |
24 | server <- function(input, output) {
25 |
26 | output$selection_text <- renderUI({
27 |
28 | paste("The selected option is", input$select)
29 | })
30 |
31 | output$comment_text <- renderText({
32 |
33 | input$comment
34 | })
35 | }
36 |
37 | shinyApp(ui = ui, server = server)
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt2/images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/dynamic-shinyUI-pt2/images/error.png
--------------------------------------------------------------------------------
/dynamic-shinyUI-pt2/images/example1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/dynamic-shinyUI-pt2/images/example1.png
--------------------------------------------------------------------------------
/flexdashboard/resources/STATWORX_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/flexdashboard/resources/STATWORX_2.jpg
--------------------------------------------------------------------------------
/flowchart/R_network_functions/dataprep/foo_01.R:
--------------------------------------------------------------------------------
1 | foo_01 <- function(x) {
2 |
3 | foo_05 <- function(x){
4 | print("bla")
5 | }
6 |
7 | foo_09 <- function(x){ print("bla") }
8 |
9 | foo_10 <- function(x){
10 | print("JA")
11 | foo_11 <- function(x) {print("bla") }
12 |
13 | print("sg")
14 |
15 | foo_12<- function(x) {
16 | print("bla")
17 | foo_13(1)
18 | }
19 |
20 | foo_13 <- function(x) {
21 | print("bla")
22 | }
23 |
24 | foo_11(2)
25 | foo_12(2)
26 | }
27 |
28 | foo_05(x = 3)
29 | foo_05(x = 3)
30 | foo_05(x = 3)
31 | foo_10(x = 3)
32 | sapply(1:5, foo_05)
33 |
34 | foo_09(2)
35 | foo_09(2)
36 | foo_09(2)
37 | '
38 | comments'
39 |
40 | a <- 'adgf'
41 |
42 | foo_02(x = 4)
43 | }
--------------------------------------------------------------------------------
/flowchart/R_network_functions/method/foo_02.R:
--------------------------------------------------------------------------------
1 | foo_02 <- function(x) {
2 |
3 | foo_02_intern <- function(x){
4 | print("blub")
5 | }
6 |
7 | foo_06<-function(x){
8 | print("blub")
9 | if (TRUE) {
10 | 1
11 | } else {
12 | 2
13 | }
14 | foo_07(x)
15 | }
16 |
17 | foo_07 <-function(x){
18 | print("blub")
19 | }
20 |
21 | '
22 | foo_08<- function(x){
23 | print("blub")
24 | }
25 | '
26 | foo_08b<- function(x){
27 | print("blub")
28 | foo_07(x)
29 | }
30 | '
31 | not used
32 | but stil here'
33 |
34 | foo_02_intern(x = 3)
35 | foo_06(x)
36 | foo_07(x)
37 | foo_08b(x)
38 |
39 | }
--------------------------------------------------------------------------------
/flowchart/R_network_functions/script_01.R:
--------------------------------------------------------------------------------
1 |
2 | # test script for R functions network plot
3 |
4 | source("/Users/jakobgepp/Projekte/2018/Intern/R Network functions/foo_01.R")
5 | source("/Users/jakobgepp/Projekte/2018/Intern/R Network functions/foo_02.R")
6 |
7 | # source srcipt
8 | source("/Users/jakobgepp/Projekte/2018/Intern/R Network functions/script_02.R")
9 |
10 |
11 | foo_03 <- function(x) {
12 | foo_01(x)
13 | foo_02(x)
14 |
15 | # emtpy
16 | }
17 | foo_23 <- function (x) {
18 | #foo_03(x)
19 | }
20 | # DONE
--------------------------------------------------------------------------------
/flowchart/R_network_functions/script_02.R:
--------------------------------------------------------------------------------
1 | # do some stuff
2 |
3 | # need a helper function
4 |
5 | foo_01(x)
6 | foo_06(x)
7 |
8 | # done
--------------------------------------------------------------------------------
/flowchart/create_network.R:
--------------------------------------------------------------------------------
1 |
2 | # settings ---------------------------------------------------------------
3 |
4 | library(ggplot2)
5 | library(stringr)
6 |
7 | library(GGally)
8 | library(network)
9 | #library(threejs)
10 | #library(htmlwidgets)
11 | library(igraph)
12 | library(sna)
13 | #library(visNetwork)
14 | #library(networkD3)
15 | #library(ndtv)
16 |
17 | source("flowchart/getnetwork.R")
18 | # load network ------------------------------------------------------------
19 |
20 | dir <- "flowchart/R_network_functions"
21 |
22 | net <- getnetwork(dir = dir)
23 | g1 <- net$igraph
24 |
25 | # create plots ------------------------------------------------------------
26 | l <- layout_with_fr(g1)
27 | colrs <- rainbow(length(unique(V(g1)$color)))
28 |
29 | plot(g1,
30 | edge.arrow.size=.1,
31 | #vertex.label=NA,
32 | edge.width = 5*E(g1)$weight/max(E(g1)$weight),
33 | vertex.shape="none",
34 | #vertex.shape="rectangle",
35 | #vertex.size = (sapply(V(g1)$label, nchar))*2,
36 | #vertex.size2 = 5,
37 | #vertex.label=V(g1)$label,
38 | #vertex.label.font=2,
39 | vertex.label.color=colrs[V(g1)$color],
40 | vertex.label.color="black",
41 | #vertex.size = V(g1)$size,
42 | vertex.size = 20,
43 | #vertex.label.cex=V(g1)$size,
44 | vertex.color = colrs[V(g1)$color],
45 | edge.color="steelblue1",
46 | layout = l)
47 | legend(x=0,
48 | unique(V(g1)$folder), pch=21,
49 | #col="#777777",
50 | pt.bg= colrs[unique(V(g1)$color)],
51 | pt.cex=2, cex=.8, bty="n", ncol=1)
52 |
53 |
54 |
55 | # weighted bipartite network
56 | fnet <-network(net$matrix,
57 | matrix.type = "adjacency",
58 | ignore.eval = FALSE,
59 | names.eval = "weights",
60 | directed = TRUE)
61 |
62 | plot.ggnet <- ggnet2(fnet,
63 | node.size = V(g1)$size,
64 | color = V(g1)$folder,
65 | palette = "Blues",
66 | arrow.size = 12,
67 | arrow.gap = 0.025,
68 | label = TRUE,
69 | edge.label = "weights") +
70 | guides(size = FALSE)
71 | plot(plot.ggnet)
72 |
73 |
--------------------------------------------------------------------------------
/flowchart/plots/example-network-helfRlein.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/flowchart/plots/example-network-helfRlein.png
--------------------------------------------------------------------------------
/flowchart/plots/improved-network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/flowchart/plots/improved-network.png
--------------------------------------------------------------------------------
/food_for_regression/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/food_for_regression/.DS_Store
--------------------------------------------------------------------------------
/interactive_histogram/README.md:
--------------------------------------------------------------------------------
1 | # Fixing the most common problem with Plotly histograms
2 |
3 | Coming soon ...
4 |
5 | Please check our [blog](https://www.statworx.com/blog/) for more details.
6 |
7 | - The code should be executed within a Jupyter notebook or Jupyterlab using the .ipynb file or you can [launch an online demo here](https://mybinder.org/v2/gh/STATWORX/blog/master?filepath=interactive_histogram%2Finteractive_histogram.ipynb) [](https://mybinder.org/v2/gh/STATWORX/blog/master?filepath=interactive_histogram%2Finteractive_histogram.ipynb)
8 | - If you want to have a quick glance or copy the code, you can use the .py file which was auto-generated by [jupytext](https://github.com/mwouts/jupytext).
--------------------------------------------------------------------------------
/interactive_histogram/interactive_histogram.py:
--------------------------------------------------------------------------------
1 | # %%
2 | # installation guide:
3 | # # plotly: please refer to the official plotly.py repository
4 | # https://github.com/plotly/plotly.py#installation
5 | # # numpy: you can install it via the terminal using
6 | # pip install numpy
7 |
8 |
9 | import plotly.graph_objs as go
10 | import numpy as np
11 |
12 |
13 | x_values = np.random.randn(5000)
14 | figure = go.FigureWidget(data=[go.Histogram(x=x_values, nbinsx=10)], layout=go.Layout(xaxis={'range': [-4, 4]}, bargap=0.05))
15 | histogram = figure.data[0]
16 |
17 | def adjust_histogram_data(xaxis, xrange):
18 | x_values_subset = x_values[np.logical_and(xrange[0] <= x_values, x_values <= xrange[1])]
19 | histogram.x = x_values_subset
20 | figure.layout.xaxis.on_change(adjust_histogram_data, 'range')
21 |
22 |
23 | display(figure) # show the figure in the cell output
24 |
25 | # %%
26 | # default plotly histogram, so that you can compare the output
27 | default_histogram = go.FigureWidget([go.Histogram(x=x_values, nbinsx=10)], go.Layout(xaxis={'range': [-4, 4]}, bargap=0.05))
28 | display(default_histogram)
29 |
30 |
31 | # %%
32 |
33 |
--------------------------------------------------------------------------------
/interactive_network_visualization/global.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(visNetwork)
3 |
4 |
5 |
--------------------------------------------------------------------------------
/interactive_network_visualization/lesmis_network.R:
--------------------------------------------------------------------------------
1 | rm(list = ls())
2 |
3 | # Libraries ---------------------------------------------------------------
4 | library(visNetwork)
5 | library(geomnet)
6 | library(igraph)
7 |
8 |
9 | # Data Preparation --------------------------------------------------------
10 |
11 | # Load dataset
12 | data(lesmis)
13 |
14 | # Nodes
15 | nodes <- as.data.frame(lesmis[2])
16 | colnames(nodes) <- c("id", "label")
17 |
18 | # id has to be the same like from and to columns in edges
19 | nodes$id <- nodes$label
20 |
21 | # Edges
22 | edges <- as.data.frame(lesmis[1])
23 | colnames(edges) <- c("from", "to", "width")
24 |
25 |
26 | # Create graph for Louvain
27 | graph <- graph_from_data_frame(edges, directed = FALSE)
28 |
29 | # Louvain Comunity Detection
30 | cluster <- cluster_louvain(graph)
31 |
32 | cluster_df <- data.frame(as.list(membership(cluster)))
33 | cluster_df <- as.data.frame(t(cluster_df))
34 | cluster_df$label <- rownames(cluster_df)
35 |
36 | # Create group column
37 | nodes <- left_join(nodes, cluster_df, by = "label")
38 | colnames(nodes)[3] <- "group"
39 |
40 | # Save nodes and edges for shiny app
41 | save(nodes, file = "nodes.RData")
42 | save(edges, file = "edges.RData")
43 |
44 |
45 | # Output ------------------------------------------------------------------
46 | # network 1
47 | visNetwork(nodes, edges)
48 |
49 | # network 2
50 | visNetwork(nodes, edges, width = "100%") %>%
51 | visIgraphLayout() %>%
52 | visNodes(
53 | shape = "dot",
54 | color = list(
55 | background = "#0085AF",
56 | border = "#013848",
57 | highlight = "#FF8000"
58 | ),
59 | shadow = list(enabled = TRUE, size = 10)
60 | ) %>%
61 | visEdges(
62 | shadow = FALSE,
63 | color = list(color = "#0085AF", highlight = "#C62F4B")
64 | ) %>%
65 | visOptions(
66 | highlightNearest = list(enabled = T, degree = 1, hover = T),
67 | selectedBy = "group"
68 | ) %>%
69 | visLayout(randomSeed = 11)
70 |
--------------------------------------------------------------------------------
/interactive_network_visualization/server.R:
--------------------------------------------------------------------------------
1 | shinyServer(function(input, output) {
2 | output$network <- renderVisNetwork({
3 | load("nodes.RData")
4 | load("edges.RData")
5 |
6 | visNetwork(nodes, edges) %>%
7 | visIgraphLayout()
8 | })
9 | })
10 |
--------------------------------------------------------------------------------
/interactive_network_visualization/ui.R:
--------------------------------------------------------------------------------
1 | shinyUI(
2 | fluidPage(
3 | visNetworkOutput("network")
4 | )
5 | )
6 |
--------------------------------------------------------------------------------
/movie_recommendation/app.R:
--------------------------------------------------------------------------------
1 | library(shinyWidgets)
2 | library(DT)
3 | library(tidyverse)
4 | library(dplyr)
5 | library(reshape2)
6 | library(recommenderlab)
7 |
8 | source("load_data.R", local = TRUE)$value
9 |
10 | ui <- fluidPage(
11 | sidebarPanel(
12 | h2("Introduction"),
13 | h5("This shiny app is a simple example for a movie recommender described in
14 | a blog post by STATWORX. STATWORX is a consulting company for data science,
15 | machine learning and AI based in Frankfurt, Germany."),
16 | uiOutput("tab"),
17 | h5("To use this recommender, select up to 10 movies from the dropdown menue
18 | and rate them from 0 = bad to 5 = good. When you press the run button a
19 | movie recommendation based on your rating will be displayed."),
20 | br(),
21 | h2("Select and rate movies"),
22 | pickerInput(inputId = "movie_selection",
23 | label = "",
24 | choices = movie_names,
25 | selected = movie_names[1:2],
26 | options = pickerOptions(
27 | actionsBox = FALSE,
28 | maxOptions = 10 # maximum of options
29 | ),
30 | multiple = TRUE),
31 | h4(" "),
32 | uiOutput("movie_rating01"),
33 | uiOutput("movie_rating02"),
34 | uiOutput("movie_rating03"),
35 | uiOutput("movie_rating04"),
36 | uiOutput("movie_rating05"),
37 | uiOutput("movie_rating06"),
38 | uiOutput("movie_rating07"),
39 | uiOutput("movie_rating08"),
40 | uiOutput("movie_rating09"),
41 | uiOutput("movie_rating10"),
42 | actionButton("run", "Run")
43 | ),
44 | mainPanel(
45 | tableOutput("recomm")
46 | )
47 | )
48 |
49 |
50 | server <- function(input, output, session) {
51 | source("ui_server.R", local = TRUE)$value
52 | source("data_server.R", local = TRUE)$value
53 | url <- a("here", href="https://www.statworx.com/de/blog/")
54 | output$tab <- renderUI({
55 | tagList("You can find this blog post ", url, ".")
56 | })
57 | }
58 |
59 | shinyApp(ui = ui, server = server)
60 |
--------------------------------------------------------------------------------
/movie_recommendation/data_server.R:
--------------------------------------------------------------------------------
1 | recomdata <- reactive({
2 | selected_movies <- movie_data %>%
3 | filter(movieId %in% new_movieId) %>%
4 | filter(title %in% input$movie_selection) %>%
5 | arrange(title) %>%
6 | select(-c(genres))
7 |
8 | for(i in 1:nrow(selected_movies)){
9 | selected_movies$ratingvec[i] <- input[[as.character(selected_movies$title[i])]]
10 | }
11 |
12 | rating_vec <- new_movies %>% left_join(., selected_movies, by = "movieId") %>%
13 | pull(ratingvec)
14 | rating_vec <- as.matrix(t(rating_vec))
15 | rating_vec <- as(rating_vec, "realRatingMatrix")
16 | top_5_prediction <- predict(rec_mod, rating_vec, n = 5)
17 | top_5_list <- as(top_5_prediction, "list")
18 | top_5_df <- data.frame(top_5_list)
19 | colnames(top_5_df) <- "movieId"
20 | top_5_df$movieId <- as.numeric(levels(top_5_df$movieId))
21 | names <- left_join(top_5_df, movie_data, by="movieId")
22 | names <- as.data.frame(names) %>%select(-c(movieId, genres)) %>%
23 | rename(Title = title)
24 | names
25 | })
26 |
27 |
28 | observeEvent(input$run, {
29 |
30 | recomdata <- recomdata()
31 |
32 | if(length(input$movie_selection) < 2){
33 | sendSweetAlert(
34 | session = session,
35 | title = "Please select more movies.",
36 | text = "Rate at least two movies.",
37 | type = "info")
38 | } else if(nrow(recomdata) < 1){
39 | sendSweetAlert(
40 | session = session,
41 | title = "Please vary in your ratings.",
42 | text = "Do not give the same rating for all movies.",
43 | type = "info")
44 |
45 | } else{
46 | output$recomm <- renderTable(recomdata)
47 | }
48 |
49 | })
50 |
--------------------------------------------------------------------------------
/movie_recommendation/load_data.R:
--------------------------------------------------------------------------------
1 | # You can find the dataset for this movie recommendation here:
2 | # https://grouplens.org/datasets/movielens/latest/
3 | # Download the ml-latest-small.zip file and read the movies.csv as movie_data
4 | # and ratings.csv as ratings_data
5 |
6 | movie_data <- readRDS("movie_data")
7 | ratings_data <- readRDS("ratings_data")
8 |
9 | new_movieId <- ratings_data %>% group_by(movieId) %>%
10 | summarise(count = n()) %>%
11 | filter(count > 50) %>%
12 | pull(movieId)
13 |
14 | new_movies <- movie_data %>% filter(movieId %in% new_movieId)
15 |
16 | movie_names <- movie_data %>%
17 | filter(movieId %in% new_movieId) %>% pull(title) %>%
18 | as.character() %>% sort()
19 |
20 | ratings_data <- ratings_data %>% filter(movieId %in% new_movieId)
21 | rating_mat <- dcast(ratings_data, userId ~ movieId, value.var = "rating",
22 | na.rm=FALSE)
23 | rating_mat <- as.matrix(rating_mat[,-1])
24 | rating_mat <- as(rating_mat, "realRatingMatrix")
25 |
26 | rec_mod <- Recommender(rating_mat, method = "UBCF",
27 | param = list(method = "pearson", nn = 40)
28 | )
29 |
--------------------------------------------------------------------------------
/pandas_vs_datatable/README.md:
--------------------------------------------------------------------------------
1 | ### pandas versus data.table
2 |
3 | This directory contains the folder structure of the project that clocks pandas and data.tables on common data wrangling tasks.
4 | If you find bugs (happens :)), you want to share your own experience with this subject, or you just want to say hello, feel free to shoot us an e-mail.
5 |
--------------------------------------------------------------------------------
/pandas_vs_datatable/code/arrange.R:
--------------------------------------------------------------------------------
1 | ##
2 | ## ARRANGE
3 | ##
4 |
5 | library(data.table)
6 | library(microbenchmark)
7 | library(jsonlite)
8 | library(dplyr)
9 | library(tidyr)
10 | library(purrr)
11 |
12 | # Functions
13 | source("code/functions.R")
14 |
15 | scenarios <- jsonlite::read_json("output/arrange.JSON")
16 |
17 | n_cols <- names(scenarios)
18 | n_rows <- gsub(".*_(.*).csv$", "\\1", list.files("data")) %>% unique()
19 |
20 | res_list <- list()
21 | i_glob <- 1
22 |
23 | # Colums of data
24 | for (n_col in n_cols) {
25 |
26 | # Rows of data
27 | for (n_row in n_rows) {
28 |
29 | cat("=== Data with ", n_col, " columns and ", n_row, " rows ===\n")
30 |
31 | cat("File load ... \n")
32 | filep <- sprintf("data/sim_data_%s_%s.csv", n_col, n_row)
33 | dt <- fread(filep)
34 |
35 | # Scenarios
36 | for (i in seq(scenarios[[n_col]])) {
37 |
38 | cat("Scenario: ", i, "\n")
39 |
40 | arrange_szenario <- names(scenarios[[n_col]])[i]
41 | arrange_cols <- scenarios[[n_col]][[i]] %>% unlist()
42 |
43 | # Get system time in milliseconds
44 | mb <- microbenchmark(setorderv(dt, cols = arrange_cols), times = 100L)
45 | median_time <- median(mb$time / 1e6) # milliseconds
46 | mean_time <- mean(mb$time / 1e6)
47 | min_time <- min(mb$time / 1e6)
48 | max_time <- max(mb$time / 1e6)
49 |
50 | # Save result
51 | res_list[[i_glob]] <- list(
52 | n_col = n_col,
53 | n_row = n_row,
54 | scenario = arrange_szenario,
55 | min_time = min_time,
56 | mean_time_ms = mean_time,
57 | median_time_ms = median_time,
58 | max_time = max_time
59 | )
60 | i_glob <- i_glob + 1
61 | }
62 | }
63 | }
64 |
65 | result <- res_list %>% dplyr::bind_rows()
66 | saveRDS(result, "output/arrange_results.RDS")
67 | fwrite(result, file = "output/arrange_results.csv")
68 |
69 | result %>% arrange(n_col, n_row, scenario) %>% View()
70 |
71 | # Plot results
72 | library(ggplot2)
73 | result %>%
74 | ggplot(aes(x = as.factor(as.numeric(n_row)), y = as.factor(as.numeric(n_col)), fill = median_time_ms)) +
75 | geom_tile() +
76 | geom_text(aes(label = round(median_time_ms, 1)), col = "white") +
77 | labs(x = "# Rows", y = "# Columns") +
78 | facet_wrap( ~ scenario) +
79 | scale_fill_continuous("Median\narrange time\n(milliseconds)") +
80 | ggtitle("Data.table median arrange time", subtitle = "For 5 scenarios (100 runs each")
81 |
82 | # Save
83 | ggsave("output/arrange_results_datatable.pdf")
84 |
--------------------------------------------------------------------------------
/pandas_vs_datatable/code/filter.R:
--------------------------------------------------------------------------------
1 | ##
2 | ## FILTER
3 | ##
4 |
5 | library(data.table)
6 | library(microbenchmark)
7 | library(jsonlite)
8 | library(dplyr)
9 | library(tidyr)
10 | library(purrr)
11 |
12 | # Functions
13 | source("code/functions.R")
14 |
15 | scenarios <- jsonlite::read_json("output/filter.JSON")
16 |
17 | n_cols <- names(scenarios)
18 | n_rows <- gsub(".*_(.*).csv$", "\\1", list.files("data")) %>% unique()
19 |
20 | filter_cols <- list(1, 2, 3, 4, 1:2, 1:3, 1:4)
21 | operations <- list(">=", ">=", "==", "==", ">=", c(">=", ">=", "=="),
22 | c(">=", ">=", "==", "=="))
23 |
24 | res_list <- list()
25 | i_glob <- 1
26 |
27 | # Colums of data
28 | # n_col <- n_cols[1]
29 | for (n_col in n_cols) {
30 |
31 | # Rows of data
32 | # n_row <- n_rows[1]
33 | for (n_row in n_rows) {
34 |
35 | cat("=== Data with ", n_col, " columns and ", n_row, " rows ===\n")
36 |
37 | cat("File load ... \n")
38 | filep <- sprintf("data/sim_data_%s_%s.csv", n_col, n_row)
39 | dt <- fread(filep)
40 |
41 | # Scenarios
42 | # i <- seq(filter_cols)[6]
43 | for (i in seq(filter_cols)) {
44 |
45 | cat("Scenario: ", i, "\n")
46 |
47 | filter <- scenarios[[n_col]][filter_cols[[i]]] %>% unlist()
48 | operation <- operations[[i]]
49 |
50 | query <- sprintf("`%s` %s %s", names(filter), operation, filter)
51 | query[grepl("^`STR", query)] <- gsub("([a-zA-Z]+)$", "'\\1'", query[grepl("^`STR", query)])
52 | query <- paste(query, collapse = " & ")
53 | cat("... query:", query, "\n")
54 |
55 | # Get system time in milliseconds
56 | mb <- microbenchmark(dt[eval(parse(text = query)), ], times = 100L)
57 | median_time <- median(mb$time / 1e6) # milliseconds
58 | mean_time <- mean(mb$time / 1e6)
59 | min_time <- min(mb$time / 1e6)
60 | max_time <- max(mb$time / 1e6)
61 |
62 | # Save result
63 | res_list[[i_glob]] <- list(
64 | n_col = n_col,
65 | n_row = n_row,
66 | scenario = i,
67 | min_time = min_time,
68 | mean_time_ms = mean_time,
69 | median_time_ms = median_time,
70 | max_time = max_time
71 | )
72 | i_glob <- i_glob + 1
73 | }
74 | }
75 | }
76 |
77 | result <- res_list %>% dplyr::bind_rows()
78 | saveRDS(result, "output/filter_results.RDS")
79 | fwrite(result, file = "output/filter_results.csv")
80 |
81 | # Plot results
82 | library(ggplot2)
83 | result %>%
84 | ggplot(aes(x = as.factor(as.numeric(n_row)), y = as.factor(as.numeric(n_col)), fill = median_time_ms)) +
85 | geom_tile() +
86 | geom_text(aes(label = round(median_time_ms, 1)), col = "white") +
87 | labs(x = "# Rows", y = "# Columns") +
88 | facet_wrap( ~ scenario) +
89 | scale_fill_continuous("Median\nfiltertime\n(milliseconds)") +
90 | ggtitle("Data.table median filter time", subtitle = "For 7 scenarios (100 runs each")
91 |
92 | # # Save
93 | # ggsave("output/filter_results_datatable.pdf")
94 |
--------------------------------------------------------------------------------
/pandas_vs_datatable/code/functions.R:
--------------------------------------------------------------------------------
1 | ###
2 | # draw_ind_for_selsid
3 | #
4 | # Draws `n_draws` columns indices of a data frame with `n_cols` columns. `pos`
5 | # indicates the position from where draws should be generated
6 | ##
7 |
8 | draw_ind_for_select <- function(n_cols, n_draws, pos = "any") {
9 |
10 | lb <- n_cols / 3 * switch(pos, "beg" = 0, "any" = 0, "mid" = 1, "end" = 2) + 1
11 | ub <- n_cols / 3 * switch(pos, "beg" = 1, "any" = 3, "mid" = 2, "end" = 3)
12 |
13 | sample(lb:ub, n_draws, FALSE)
14 |
15 | }
--------------------------------------------------------------------------------
/pandas_vs_datatable/code/mutate.R:
--------------------------------------------------------------------------------
1 | ##
2 | ## MUTATE
3 | ##
4 |
5 | library(data.table)
6 | library(microbenchmark)
7 | library(jsonlite)
8 | library(dplyr)
9 | library(tidyr)
10 | library(purrr)
11 |
12 | # Functions
13 | source("code/functions.R")
14 |
15 | scenarios <- jsonlite::read_json("output/mutate.JSON")
16 |
17 | n_cols <- names(scenarios)
18 | n_rows <- gsub(".*_(.*).csv$", "\\1", list.files("data")) %>% unique()
19 |
20 | #gb_label <- c("zip", "pois", "unif")
21 | mutate_label <- c("INT", "DBL", "STR", "LGL")
22 |
23 | res_list <- list()
24 | i_glob <- 1
25 |
26 | # Colums of data
27 | for (n_col in n_cols) {
28 |
29 | # Rows of data
30 | for (n_row in n_rows) {
31 |
32 | cat("=== Data with ", n_col, " columns and ", n_row, " rows ===\n")
33 |
34 | cat("File load ... \n")
35 | filep <- sprintf("data/sim_data_%s_%s.csv", n_col, n_row)
36 | dt <- fread(filep)
37 |
38 | m_cols <- scenarios[[n_col]][["mutate"]] %>% unlist(.)
39 |
40 | # W/O group_by
41 | for (i in seq(m_cols)) {
42 |
43 | cat("Szenario:", i, "\n")
44 |
45 | m_col <- m_cols[i]
46 |
47 | # Get system time in milliseconds
48 | mb <- switch(i,
49 | "1" = microbenchmark(dt[, result := get(m_col) + 1], times = 100L),
50 | "2" = microbenchmark(dt[, result := get(m_col) * 2], times = 100L),
51 | "3" = microbenchmark(dt[, result := paste0(get(m_col), "a")], times = 100L),
52 | "4" = microbenchmark(dt[, result := !get(m_col)], times = 100L),
53 | NULL
54 | )
55 |
56 | median_time <- median(mb$time / 1e6) # milliseconds
57 | mean_time <- mean(mb$time / 1e6)
58 | min_time <- min(mb$time / 1e6)
59 | max_time <- max(mb$time / 1e6)
60 |
61 | # Save result
62 | res_list[[i_glob]] <- list(
63 | n_col = n_col,
64 | n_row = n_row,
65 | scenario = sprintf("mutate_%s", mutate_label[i]),
66 | min_time = min_time,
67 | mean_time_ms = mean_time,
68 | median_time_ms = median_time,
69 | max_time = max_time
70 | )
71 | i_glob <- i_glob + 1
72 | }
73 | }
74 | }
75 |
76 | result <- res_list %>% dplyr::bind_rows()
77 | saveRDS(result, "output/filter_results.RDS")
78 | fwrite(result, file = "output/filter_results.csv")
79 |
80 | # Plot results
81 | library(ggplot2)
82 | result %>%
83 | ggplot(aes(x = as.factor(as.numeric(n_row)), y = as.factor(as.numeric(n_col)), fill = median_time_ms)) +
84 | geom_tile() +
85 | geom_text(aes(label = round(median_time_ms, 1)), col = "white") +
86 | labs(x = "# Rows", y = "# Columns") +
87 | facet_wrap( ~ scenario) +
88 | scale_fill_continuous("Median\nmutate time\n(milliseconds)") +
89 | ggtitle("Data.table median mutate time", subtitle = "For 4 scenarios (100 runs each")
90 |
91 | # Save
92 | ggsave("output/filter_results_datatable.pdf")
93 |
--------------------------------------------------------------------------------
/pandas_vs_datatable/code/select.R:
--------------------------------------------------------------------------------
1 | ##
2 | ## SELECT
3 | ##
4 |
5 | library(data.table)
6 | library(microbenchmark)
7 | library(jsonlite)
8 | library(dplyr)
9 | library(tidyr)
10 | library(purrr)
11 |
12 | scenarios <- jsonlite::read_json("output/select.JSON") %>% transpose()
13 |
14 | n_cols <- names(scenarios)
15 | n_rows <- gsub(".*_(.*).csv$", "\\1", list.files("data")) %>% unique()
16 |
17 | sel_fun <- function(x) {
18 | return( dt[, .SD, .SDcols = x] )
19 | }
20 |
21 | res_list <- list()
22 | i_glob <- 1
23 |
24 | # Colums of data
25 | for (n_col in n_cols) {
26 |
27 | # Rows of data
28 | for (n_row in n_rows) {
29 |
30 | cat("=== Data with ", n_col, " columns and ", n_row, " rows ===\n")
31 |
32 | cat("File load ... \n")
33 | filep <- sprintf("data/sim_data_%s_%s.csv", n_col, n_row)
34 | dt <- fread(filep)
35 |
36 | # Scenarios
37 | for (scenario in names(scenarios[[n_col]])) {
38 |
39 | cat("Scenario: ", scenario, "\n")
40 |
41 | sel_ind <- scenarios[[n_col]][[scenario]] %>% unlist()
42 | sel_col <- names(dt)[sel_ind]
43 |
44 | # Get system time in milliseconds
45 | mb <- microbenchmark(sel_fun(sel_col))
46 | median_time <- median(mb$time / 1e6) # milliseconds
47 | mean_time <- mean(mb$time / 1e6)
48 | min_time <- min(mb$time / 1e6)
49 | max_time <- max(mb$time / 1e6)
50 |
51 | # Save result
52 | res_list[[i_glob]] <- list(
53 | n_col = n_col,
54 | n_row = n_row,
55 | scenario = scenario,
56 | min_time = min_time,
57 | mean_time_ms = mean_time,
58 | median_time_ms = median_time,
59 | max_time = max_time
60 | )
61 | i_glob <- i_glob + 1
62 | }
63 | }
64 | }
65 |
66 | result <- res_list %>% dplyr::bind_rows()
67 | saveRDS(result, "output/select_results.RDS")
68 | fwrite(result, file = "output/select_results.csv")
69 |
70 | # Plot results
71 | library(ggplot2)
72 | result %>%
73 | mutate(num_sel = gsub("s(\\d).*", "\\1", scenario),
74 | pos_sel = gsub("^s\\d(.*)$", "\\1", scenario)) %>%
75 | ggplot(aes(x = as.factor(as.numeric(n_row)), y = as.factor(as.numeric(n_col)), fill = median_time_ms)) +
76 | geom_tile() +
77 | labs(x = "# Rows", y = "# Columns") +
78 | facet_grid(pos_sel ~ num_sel) +
79 | scale_fill_continuous("Median\nselection time\n(milliseconds)") +
80 | ggtitle("Data.table median selection time", subtitle = "For number of variables selected and position")
81 |
82 | # Save
83 | ggsave("output/select_results.pdf")
84 |
--------------------------------------------------------------------------------
/pandas_vs_datatable/data/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/pandas_vs_datatable/data/.DS_Store
--------------------------------------------------------------------------------
/pandas_vs_datatable/output/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/pandas_vs_datatable/output/.DS_Store
--------------------------------------------------------------------------------
/r-script-in-docker/.gitignore:
--------------------------------------------------------------------------------
1 | # Don't track files with these extensions
2 | *.DS_Store
3 | .Rproj.user
4 | BlogBody.md
--------------------------------------------------------------------------------
/r-script-in-docker/01_data/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore everything in this directory
2 | *
3 | # Except this file
4 | !.gitignore
5 | # and the input data file
6 | !us-500.zip
7 | !us-500.csv
8 |
--------------------------------------------------------------------------------
/r-script-in-docker/01_data/us-500.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/r-script-in-docker/01_data/us-500.zip
--------------------------------------------------------------------------------
/r-script-in-docker/02_code/install_packages.R:
--------------------------------------------------------------------------------
1 | install.packages("readr")
2 | install.packages("dplyr")
3 | install.packages("ggplot2")
4 | install.packages("forcats")
--------------------------------------------------------------------------------
/r-script-in-docker/02_code/myScript.R:
--------------------------------------------------------------------------------
1 | library(readr)
2 | library(dplyr)
3 | library(ggplot2)
4 | library(forcats)
5 |
6 | # import dataframe
7 | df <- read_csv("01_data/us-500.csv")
8 |
9 | # manipulate data
10 | plot_data <- df %>%
11 | group_by(state) %>%
12 | count()
13 |
14 | # save manipulated data to output folder
15 | write_csv(plot_data, "03_output/plot_data.csv")
16 |
17 | # create plot based on manipulated data
18 | plot <- plot_data %>%
19 | ggplot()+
20 | geom_col(aes(fct_reorder(state, n),
21 | n,
22 | fill = n))+
23 | coord_flip()+
24 | labs(
25 | title = "Number of people by state",
26 | subtitle = "From US-500 dataset",
27 | x = "State",
28 | y = "Number of people"
29 | )+
30 | theme_bw()
31 |
32 | # save plot to output folder
33 | ggsave("03_output/myplot.png", width = 10, height = 8, dpi = 100)
--------------------------------------------------------------------------------
/r-script-in-docker/02_code/myScriptFinal.R:
--------------------------------------------------------------------------------
1 | suppressPackageStartupMessages(library(readr))
2 | suppressPackageStartupMessages(library(dplyr))
3 | suppressPackageStartupMessages(library(ggplot2))
4 | suppressPackageStartupMessages(library(forcats))
5 |
6 | options(scipen = 999,
7 | readr.num_columns = 0)
8 |
9 | print("Starting Workflow")
10 |
11 | # import dataframe
12 | print("Importing Dataframe")
13 | df <- read_csv("01_data/us-500.csv")
14 |
15 | # manipulate data
16 | print("Manipulating Data")
17 | plot_data <- df %>%
18 | group_by(state) %>%
19 | count()
20 |
21 | # save manipulated data to output folder
22 | print("Writing manipulated Data to .csv")
23 | write_csv(plot_data, "03_output/plot_data.csv")
24 |
25 | # create plot based on manipulated data
26 | print("Creating Plot")
27 | plot <- plot_data %>%
28 | ggplot()+
29 | geom_col(aes(fct_reorder(state, n),
30 | n,
31 | fill = n))+
32 | coord_flip()+
33 | labs(
34 | title = "Number of people by state",
35 | subtitle = "From US-500 dataset",
36 | x = "State",
37 | y = "Number of people"
38 | )+
39 | theme_bw()
40 |
41 | # save plot to output folder
42 | print("Saving Plot")
43 | ggsave("03_output/myplot.png", width = 10, height = 8, dpi = 100)
44 | print("Worflow Finished")
45 |
--------------------------------------------------------------------------------
/r-script-in-docker/03_output/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore everything in this directory
2 | *
3 | # Except this file
4 | !.gitignore
--------------------------------------------------------------------------------
/r-script-in-docker/Dockerfile:
--------------------------------------------------------------------------------
1 | # Base image https://hub.docker.com/u/rocker/
2 | FROM rocker/r-base:latest
3 |
4 | ## create directories
5 | RUN mkdir -p /01_data
6 | RUN mkdir -p /02_code
7 | RUN mkdir -p /03_output
8 |
9 | ## copy files
10 | COPY /02_code/install_packages.R /02_code/install_packages.R
11 | COPY /02_code/myScript.R /02_code/myScript.R
12 |
13 | ## install R-packages
14 | RUN Rscript /02_code/install_packages.R
15 |
--------------------------------------------------------------------------------
/r-script-in-docker/Dockerfile.final:
--------------------------------------------------------------------------------
1 | # Base image https://hub.docker.com/u/oliverstatworx/
2 | FROM oliverstatworx/base-r-tidyverse:latest
3 |
4 | ## create directories
5 | RUN mkdir -p /01_data
6 | RUN mkdir -p /02_code
7 | RUN mkdir -p /03_output
8 |
9 | ## copy files
10 | COPY /02_code/myScriptFinal.R /02_code/myScriptFinal.R
11 |
12 | ## run the script
13 | CMD Rscript /02_code/myScriptFinal.R
14 |
--------------------------------------------------------------------------------
/r-script-in-docker/R-Script in Docker.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
--------------------------------------------------------------------------------
/r-script-in-docker/docker build.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/r-script-in-docker/docker build.png
--------------------------------------------------------------------------------
/r-script-in-docker/docker run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/r-script-in-docker/docker run.png
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | jupytext==0.8.6
2 | numpy==1.14.3
3 | pandas==0.23.4
4 | plotly==3.5.0
--------------------------------------------------------------------------------
/shiny_friend_scorer/data/friend_score.RDS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/shiny_friend_scorer/data/friend_score.RDS
--------------------------------------------------------------------------------
/shiny_friend_scorer/data/raw/friend_score.csv:
--------------------------------------------------------------------------------
1 | name;score
2 | John;7
3 | Emily;3
4 | Olivia;0
5 | Ethan;-1
--------------------------------------------------------------------------------
/shiny_friend_scorer/data/raw/visit_log.csv:
--------------------------------------------------------------------------------
1 | name;exp_time;act_time;reason;good_reason
2 | John;2018-09-20 18:30:00;2018-09-20 18:30:00;;
3 | Ethan;2018-09-21 17:15:00;2018-09-21 18:03:00;just shrugged his shoulders;no
4 | Emily;2018-10-01 08:15:00;2018-10-01 08:15:00;;
5 | John;2018-10-01 19:20:00;2018-10-01 19:24:00;;
6 | Olivia;2018-10-03 20:00:00;2018-10-03 20:08:00;had to finish her statworx blog post;yes
7 | Ethan;2018-10-07 10:15:00;2018-10-07 10:13:00;;
--------------------------------------------------------------------------------
/shiny_friend_scorer/data/visit_log.RDS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/shiny_friend_scorer/data/visit_log.RDS
--------------------------------------------------------------------------------
/shiny_friend_scorer/functions/utils.R:
--------------------------------------------------------------------------------
1 | #' Creates a datetime object from a date and a time object
2 | #'
3 | #' @param date string containing date in format yyyy-mm-dd
4 | #' @param time datetime object comprising time in HH:MM format
5 | #'
6 | #' @return datetime object
7 | convert_to_time <- function(date, time) {
8 | date %>%
9 | sprintf("%s %s", ., strftime(time, format = "%H:%M:%S")) %>%
10 | ymd_hms() %>%
11 | return()
12 | }
13 |
14 | #' Changes data in a reactiveValues object
15 | #'
16 | #' @param x a reactiveValues object that shall be altered
17 | #' @param ... key-value pairs that define what to change in x
18 | #'
19 | #' @return reavtiveValues object with the set data
20 | set_data <- function(x, ...) {
21 | args <- list(...)
22 | arg_names <- names(args)
23 | non_matching <- setdiff(arg_names, names(x))
24 | if (length(non_matching) > 0) {
25 | stop(sprintf("You cannot set the following attribute(s): %s",
26 | paste(non_matching, collapse = ", ")))
27 | }
28 | for (arg_name in arg_names) {
29 | if (arg_name %in% names(x)) {
30 | x[[arg_name]] <- args[[arg_name]]
31 | }
32 | }
33 | return(x)
34 | }
35 |
36 | #' Set all entries in reactiveValues Object to NA
37 | #'
38 | #' @param x reactiveValues object
39 | #'
40 | #' @return reavtiveValues object with all entries set to NA
41 | reset_data <- function(x) {
42 | for (n in names(x)) {
43 | x[[n]] <- NA
44 | }
45 | return(x)
46 | }
--------------------------------------------------------------------------------
/shiny_friend_scorer/global.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(shinyTime)
3 | library(magrittr)
4 | library(dplyr)
5 |
6 | # Functions
7 | source("functions/utils.R")
--------------------------------------------------------------------------------
/shiny_friend_scorer/misc/init_friend_data.R:
--------------------------------------------------------------------------------
1 | ##
2 | ## INITIALIZE FRIEND DATA
3 | ##
4 |
5 | library(data.table)
6 | library(dplyr)
7 | library(lubridate)
8 |
9 | friend_score <- fread("data/raw/friend_score.csv", data.table = FALSE)
10 | saveRDS(friend_score, "data/friend_score.RDS")
11 |
12 | visit_log <- fread("data/raw/visit_log.csv",
13 | data.table = FALSE,
14 | na.strings = "") %>%
15 | mutate(exp_time = ymd_hms(exp_time),
16 | act_time = ymd_hms(act_time))
17 | saveRDS(visit_log, "data/visit_log.RDS")
18 |
--------------------------------------------------------------------------------
/shiny_friend_scorer/ui.R:
--------------------------------------------------------------------------------
1 | shinyUI(fluidPage(
2 | title = "Friend-Tracker",
3 | h1("Keep record of your friends"),
4 | sidebarPanel(
5 | h4("Log a friend's visit"),
6 | textInput("name", "Name", placeholder = "Name ..."),
7 | fluidRow(
8 | column(6, dateInput("exp_date", "Expected arrival date")),
9 | column(6, timeInput("exp_time", "Time", seconds = FALSE))
10 | ),
11 | fluidRow(
12 | column(6, dateInput("act_date", "Actual arrival date")),
13 | column(6, timeInput("act_time", "Time", seconds = FALSE))
14 | ),
15 | numericInput("acceptance", "How many minutes are you willing to forgive?",
16 | value = 5, min = 0, max = NA, step = 1),
17 | actionButton("submit", "Submit", class = "btn-primary"),
18 | hr(),
19 | tableOutput("friend_score")
20 | ),
21 | mainPanel(
22 | tableOutput("visit_log")
23 | )
24 | ))
--------------------------------------------------------------------------------
/shinyapp-in-docker/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .Ruserdata
5 | .DS_Store
6 | *.md
7 |
8 | # log files
9 | bash_script_collection/docker_log_files
10 |
--------------------------------------------------------------------------------
/shinyapp-in-docker/Dockerfile:
--------------------------------------------------------------------------------
1 | # Base image https://hub.docker.com/u/rocker/
2 | FROM rocker/shiny:latest
3 |
4 | # system libraries of general use
5 | ## install debian packages
6 | RUN apt-get update -qq && apt-get -y --no-install-recommends install \
7 | libxml2-dev \
8 | libcairo2-dev \
9 | libsqlite3-dev \
10 | libmariadbd-dev \
11 | libpq-dev \
12 | libssh2-1-dev \
13 | unixodbc-dev \
14 | libcurl4-openssl-dev \
15 | libssl-dev
16 |
17 | ## update system libraries
18 | RUN apt-get update && \
19 | apt-get upgrade -y && \
20 | apt-get clean
21 |
22 | # copy necessary files
23 | ## renv.lock file
24 | COPY /example-app/renv.lock ./renv.lock
25 | ## app folder
26 | COPY /example-app ./app
27 |
28 | # install renv & restore packages
29 | RUN Rscript -e 'install.packages("renv")'
30 | RUN Rscript -e 'renv::restore()'
31 |
32 | # expose port
33 | EXPOSE 3838
34 |
35 | # run app on container start
36 | CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
37 |
--------------------------------------------------------------------------------
/shinyapp-in-docker/example-app/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .Ruserdata
5 | .Rprofile
6 | .DS_Store
7 | .md
8 |
9 | # log files
10 | bash_script_collection/docker_log_files
11 |
--------------------------------------------------------------------------------
/shinyapp-in-docker/example-app/example-app.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
--------------------------------------------------------------------------------
/shinyapp-in-docker/example-app/global.R:
--------------------------------------------------------------------------------
1 | library(renv)
2 | library(shiny)
3 | library(shinydashboard)
4 | library(glue)
--------------------------------------------------------------------------------
/shinyapp-in-docker/example-app/renv/.gitignore:
--------------------------------------------------------------------------------
1 | local/
2 | cellar/
3 | lock/
4 | sandbox/
5 | library/
6 | python/
7 | staging/
8 |
--------------------------------------------------------------------------------
/shinyapp-in-docker/example-app/renv/settings.dcf:
--------------------------------------------------------------------------------
1 | external.libraries:
2 | ignored.packages:
3 | package.dependency.fields: Imports, Depends, LinkingTo
4 | snapshot.type: packrat
5 | use.cache: TRUE
6 | vcs.ignore.library: TRUE
7 |
--------------------------------------------------------------------------------
/shinyapp-in-docker/example-app/server.R:
--------------------------------------------------------------------------------
1 | shinyServer(function(input, output) {
2 |
3 | output$reference <- renderUI({
4 | tabsetPanel(
5 | tabPanel(
6 | "Reference",
7 | h3("Reference Content"))
8 | )
9 | })
10 |
11 | output$comparison <- renderUI({
12 | req(input$slider)
13 |
14 | myTabs <- lapply(1:input$slider, function(i) {
15 |
16 | tabPanel(title = glue("Tab {i}"),
17 | h3(glue("Content {i}"))
18 | )
19 | })
20 | do.call(tabsetPanel, myTabs)
21 | })
22 | })
23 |
--------------------------------------------------------------------------------
/shinyapp-in-docker/example-app/ui.R:
--------------------------------------------------------------------------------
1 | shinyUI(
2 | dashboardPage(
3 | dashboardHeader(title = "Example ShinyApp"),
4 | dashboardSidebar(
5 | sliderInput(inputId = "slider",
6 | label = "dynamically change the number of tabs by using the slider",
7 | min = 1, max = 5, value = 3, step = 1)
8 | ),
9 |
10 | dashboardBody(
11 | fluidRow(
12 | box(width = 12,
13 | p(
14 | mainPanel(width = 12,
15 | column(width = 6, uiOutput("reference")),
16 | column(width = 6, uiOutput("comparison"))
17 | )
18 | )
19 | )
20 | )
21 | )
22 | )
23 | )
--------------------------------------------------------------------------------
/slackemoji/Slack_export/example/2017-11-14.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "type": "message",
4 | "user": "U03BPADJA",
5 | "text": "Im Office geht nur der AB ran, ist das Absicht?",
6 | "ts": "1510675822.000101"
7 | },
8 | {
9 | "type": "message",
10 | "user": "U03BPADJA",
11 | "text": "",
12 | "ts": "1510675830.000199"
13 | },
14 | {
15 | "type": "message",
16 | "user": "U03H1727X",
17 | "text": "Merk dir die Durchwahlen ;)",
18 | "ts": "1510675861.000369",
19 | "reactions": [
20 | {
21 | "name": "joy",
22 | "users": [
23 | "U4TGE4YJH",
24 | "U5PAQU337"
25 | ],
26 | "count": 2
27 | },
28 | {
29 | "name": "phone",
30 | "users": [
31 | "U19DE9QMR"
32 | ],
33 | "count": 1
34 | }
35 | ]
36 | },
37 | {
38 | "type": "message",
39 | "user": "U03BPADJA",
40 | "text": ":see_no_evil:",
41 | "ts": "1510675892.000093"
42 | },
43 | {
44 | "type": "message",
45 | "user": "U4U60L18W",
46 | "text": "nächstes jahr gibts stechkarten",
47 | "ts": "1510676367.000903"
48 | },
49 | {
50 | "type": "message",
51 | "user": "U03H1727X",
52 | "text": "Regt euch ab. Heute hat kein eines mal das Telefon geklingelt. ",
53 | "ts": "1510676487.000393"
54 | },
55 | {
56 | "type": "message",
57 | "user": "U03BPADJA",
58 | "text": "(ich hab nur gefragt, weil ich nicht wußte, ob evtl. das Problem oder ähnliches vorliegt)",
59 | "ts": "1510676533.000845"
60 | }
61 | ]
--------------------------------------------------------------------------------
/slackemoji/Slack_export/example/2018-03-22.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "type": "message",
4 | "user": "U3YJ7JBEU",
5 | "text": "Wollte mich mal wieder aus dem MA-Exil melden. Ich sitze gerade an den Grundzügen der MA und freue mich über jeden, der sich dazu aufopfert, mal drüber zu lesen. :slightly_smiling_face:",
6 | "ts": "1521714925.000209"
7 | },
8 | {
9 | "type": "message",
10 | "user": "U03BPADJA",
11 | "text": "Kann nichts versprechen, aber wenn ich Zeit finde, lese ich gerne drüber!",
12 | "ts": "1521715015.000502"
13 | },
14 | {
15 | "type": "message",
16 | "user": "U3YJ7JBEU",
17 | "text": "Ich fände es auch schon cool, wenn man den generellen Eindruck von Abstract, Intro und Conclusion beurteilt; also das Ding wie ein Paper liest.",
18 | "edited": {
19 | "user": "U3YJ7JBEU",
20 | "ts": "1521715186.000000"
21 | },
22 | "ts": "1521715177.000476"
23 | },
24 | {
25 | "type": "message",
26 | "user": "U03BPADJA",
27 | "text": "das sollte machbar sein, schicks mir einfach mal per Mail",
28 | "ts": "1521715200.000168"
29 | },
30 | {
31 | "type": "message",
32 | "text": "",
33 | "user": "U7D4ZLZ0U",
34 | "reactions": [
35 | {
36 | "name": "nullproblemo",
37 | "users": [
38 | "U0ADU2CSV"
39 | ],
40 | "count": 1
41 | }
42 | ],
43 | "ts": "1521723111.000612"
44 | },
45 | {
46 | "type": "message",
47 | "user": "U4U60L18W",
48 | "text": "haha :slightly_smiling_face:",
49 | "ts": "1521723404.000078"
50 | },
51 | {
52 | "type": "message",
53 | "user": "U19DE9QMR",
54 | "text": "#großerBeerpongTisch",
55 | "ts": "1521723515.000497",
56 | "reactions": [
57 | {
58 | "name": "joy",
59 | "users": [
60 | "U9JF5UCDQ",
61 | "U7D4ZLZ0U",
62 | "U9GLW5HHR"
63 | ],
64 | "count": 3
65 | }
66 | ]
67 | },
68 | {
69 | "type": "message",
70 | "user": "U03H1727X",
71 | "text": "Raubkunst :smile:",
72 | "ts": "1521723965.000083"
73 | }
74 | ]
--------------------------------------------------------------------------------
/slackemoji/emojis/new_emojilist.txt:
--------------------------------------------------------------------------------
1 | :thumbsup_all:
2 | :thumbsup_all:
3 | :-1::skin-tone-2:
4 | :+1::skin-tone-2:
5 | :+1::skin-tone-2:
6 | :-1::skin-tone-2:
7 | :+1::skin-tone-2:
8 | :+1::skin-tone-2:
9 | :thumbsup_all:
10 | :+1::skin-tone-2:
11 | :ok_hand::skin-tone-2:
12 | :suspect:
13 | :+1::skin-tone-2:
14 | :muscle::skin-tone-2:
15 | :+1::skin-tone-2:
16 | :+1::skin-tone-2:
17 | :v::skin-tone-2:
18 |
--------------------------------------------------------------------------------
/slackemoji/plots/emoji-category.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/slackemoji/plots/emoji-category.png
--------------------------------------------------------------------------------
/slackemoji/plots/emoji-network-category.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | sankeyNetwork
10 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/slackemoji/plots/emoji-network-category_files/d3-4.5.0/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2010-2016 Mike Bostock
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of the author nor the names of contributors may be used to
15 | endorse or promote products derived from this software without specific prior
16 | written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/slackemoji/plots/emoji-network-category_files/sankey-1/d3-4.5.0/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2010-2016 Mike Bostock
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of the author nor the names of contributors may be used to
15 | endorse or promote products derived from this software without specific prior
16 | written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/slackemoji/plots/emoji-over-day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/slackemoji/plots/emoji-over-day.png
--------------------------------------------------------------------------------
/slackemoji/plots/emoji-over-year.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/slackemoji/plots/emoji-over-year.png
--------------------------------------------------------------------------------
/slackemoji/plots/wordcloud-emoji.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/slackemoji/plots/wordcloud-emoji.png
--------------------------------------------------------------------------------
/slackemoji/plots/wordcloud-noemoji.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/slackemoji/plots/wordcloud-noemoji.png
--------------------------------------------------------------------------------
/slackemoji/plots/wordcloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/slackemoji/plots/wordcloud.png
--------------------------------------------------------------------------------
/sparse_matrix/README.md:
--------------------------------------------------------------------------------
1 | # Benchmark of calculations with sparse matrices
2 |
3 | In this simulation I benchmark the usage of sparse matrices. I compare the size and the time of the following operations:
4 |
5 | - transpose
6 | `t(X)`
7 | - crossproduct
8 | `X %*% t(X)`
9 | - addition
10 | `X + X`
11 | - multiplication
12 | `X * X`
13 | - switching
14 | `X[, c(2,3)] <- X[, c(3,2)]`
15 |
16 | For more information and details visit our [blog](https://www.statworx.com/de/blog/sparse-matrizen-wann-sollte-man-sie-nutzen/)!
17 |
18 |
19 |
20 | ### Results size
21 |
22 |
23 |
24 | ### Results time
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/sparse_matrix/plots/sparse-normal-matrixoperation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/sparse_matrix/plots/sparse-normal-matrixoperation.png
--------------------------------------------------------------------------------
/sparse_matrix/plots/sparse-normal-speichergroesse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/sparse_matrix/plots/sparse-normal-speichergroesse.png
--------------------------------------------------------------------------------
/sparse_matrix/results.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/STATWORX/blog/a7fcc793ce9ed7f78edf9d6e86066889236ad9a5/sparse_matrix/results.rds
--------------------------------------------------------------------------------
/svg_logos/R/R_black.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/svg_logos/R/R_colour.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
--------------------------------------------------------------------------------
/svg_logos/R/R_darkgrey.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
9 |
10 |
11 |
12 |
13 |
16 |
19 |
20 |
--------------------------------------------------------------------------------
/svg_logos/R/R_lightgrey.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
--------------------------------------------------------------------------------
/svg_logos/R/R_white.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 |
11 |
14 |
15 |
--------------------------------------------------------------------------------
/svg_logos/README.md:
--------------------------------------------------------------------------------
1 | Here is a collection of R logos as .png and as .svg.
2 |
3 | For more details you can check out our [blog](https://www.statworx.com/de/blog/)!
4 |
--------------------------------------------------------------------------------
/time series forecasting/README.md:
--------------------------------------------------------------------------------
1 | Hi everyone, here you find the data (tax.csv) for the blog post "Time Series Forecasting with Random Forest" (find it here >> https://www.r-bloggers.com/time-series-forecasting-with-random-forest/). The data originally comes from the German Statistical Office (Destatis >> https://www.destatis.de/DE/Home/_inhalt.html). You can find all the data there. To save you the click marathon through their website, you can download the CSV from our Statworx GitHub.
2 |
--------------------------------------------------------------------------------
/time series forecasting/tax.csv:
--------------------------------------------------------------------------------
1 | ;;Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember
2 | 1999;Lohn- und veranlagte Einkommenssteuer (Bund);4770424;3248528;4593955;3841968;3865702;6508042;4376795;4126936;6557046;3742821;3829553;12034050
3 | 2000;Lohn- und veranlagte Einkommenssteuer (Bund);4751760;3701576;4510742;3981841;4192974;6847190;4561977;4002316;6897459;3895489;3784630;11754106
4 | 2001;Lohn- und veranlagte Einkommenssteuer (Bund);4903309;3578260;3780249;3756955;3958986;6804324;4275798;3996955;6502401;3678143;3638711;11219751
5 | 2002;Lohn- und veranlagte Einkommenssteuer (Bund);4588428;3492419;3282972;3855685;4009673;6725101;4439791;3959103;6566598;3613473;3564873;11287284
6 | 2003;Lohn- und veranlagte Einkommenssteuer (Bund);4554765;3417360;2712496;3834606;3976852;6750868;4381879;3985249;6558449;3680433;3613352;11031963
7 | 2004;Lohn- und veranlagte Einkommenssteuer (Bund);4442880;3402457;2231488;3716591;3669246;6475303;4001061;3657090;6158564;3336958;3409095;10447053
8 | 2005;Lohn- und veranlagte Einkommenssteuer (Bund);4149375;3589521;2506300;3638514;3823830;6303071;3936311;3479711;6320822;3342314;3328150;10273101
9 | 2006;Lohn- und veranlagte Einkommenssteuer (Bund);4263280;3748726;3034233;3990633;4074460;7076702;4396053;3886306;6803181;3736382;3618638;10947221
10 | 2007;Lohn- und veranlagte Einkommenssteuer (Bund);4878935;4108531;4312115;4681817;4584623;7918353;4678197;4207790;7563648;4127956;3967531;11606492
11 | 2008;Lohn- und veranlagte Einkommenssteuer (Bund);5438710;4478353;5578635;5234702;5175748;8756339;5382786;4619441;8247572;4607316;4442599;12234311
12 | 2009;Lohn- und veranlagte Einkommenssteuer (Bund);5659592;4021338;6020711;4449832;4176949;8212521;4890474;4015032;7619448;4096061;4028174;11487738
13 | 2010;Lohn- und veranlagte Einkommenssteuer (Bund);5127267;3969687;6377161;4936092;3819146;8299085;4616996;3842483;7590631;3929266;3725174;11377292
14 | 2011;Lohn- und veranlagte Einkommenssteuer (Bund);5221913;4249066;7202874;5050107;4619730;8821780;4969285;4267479;8061218;4309005;4181831;12037329
15 | 2012;Lohn- und veranlagte Einkommenssteuer (Bund);5403331;4728195;7957301;5456226;4708250;9452382;5511656;4945994;8862317;4737059;4546002;12880267
16 | 2013;Lohn- und veranlagte Einkommenssteuer (Bund);5954258;5006656;9106572;5790879;5208230;10212793;5712741;5081401;9530529;5019493;4863720;13715704
17 | 2014;Lohn- und veranlagte Einkommenssteuer (Bund);6383919;5367419;9857015;6225213;5374126;10810914;6086145;5462299;9939424;5335191;5332948;14603312
18 | 2015;Lohn- und veranlagte Einkommenssteuer (Bund);6741554;5819687;10682332;6738555;5804883;11507238;6421898;5898697;10594330;5405356;5631772;15428838
19 | 2016;Lohn- und veranlagte Einkommenssteuer (Bund);6861702;6145715;11282549;6950495;5978408;11830995;6772136;5826260;11437128;6011649;5871158;16463515
20 | 2017;Lohn- und veranlagte Einkommenssteuer (Bund);7400398;6709745;12374979;7453348;6408948;12947108;7104475;6450766;11933260;6242902;6244010;17084639
21 | 2018;Lohn- und veranlagte Einkommenssteuer (Bund);7773131;7233126;12915903;7940863;6903788;13326116;7478086;6797579;12520815;6753986;6744393;17786874
22 | 2019;Lohn- und veranlagte Einkommenssteuer (Bund);8318279;7247556;13494254;...;...;...;...;...;...;...;...;...
--------------------------------------------------------------------------------
/unittest/quadratic_function.R:
--------------------------------------------------------------------------------
1 | quadratic_equation <- function(a, b, c)
2 | {
3 | if (a == 0)
4 | stop("Leading term cannot be zero")
5 | # Calculate determinant
6 | d <- b * b - 4 * a * c
7 |
8 | # Calculate real roots
9 | if (d < 0)
10 | rr <- c()
11 | else if (d == 0)
12 | rr <- c(-b / (2 * a))
13 | else
14 | rr <- c((-b - sqrt(d)) / (2 * a),
15 | (-b + sqrt(d)) / (2 * a))
16 |
17 | return(rr)
18 | }
19 |
20 |
21 |
--------------------------------------------------------------------------------
/unittest/test_quadratic_equation.R:
--------------------------------------------------------------------------------
1 | # Load libraries
2 | library(testthat)
3 |
4 | # Source Files
5 | source("quadratic_function.R")
6 |
7 | # Define Context
8 | context("Functionality of quadratic_root function")
9 |
10 | # Define Tests
11 | test_that("roots are distinct values", {
12 | calculated_root <- quadratic_equation(1, 7, 10)
13 |
14 | expect_is(calculated_root, "numeric")
15 | expect_length(calculated_root, 2)
16 | expect_lt( calculated_root[1], calculated_root[2])
17 | }
18 | )
19 |
20 | test_that("functions throws correct error", {
21 | expect_warning(quadratic_equation(0, 7, 10))
22 | }
23 | )
24 |
25 | test_that("function returns only one value for repeated roots", {
26 | calculated_root <- quadratic_equation(1, 6000, 9000000)
27 | expect_length(calculated_root, 1)
28 | expect_equal(calculated_root, -3000)
29 | }
30 | )
31 |
--------------------------------------------------------------------------------