class: center, middle, inverse, title-slide # Next steps ### The R Bootcamp
Twitter:
@therbootcamp
### April 2018 --- # Next steps .pull-left4[ <font size = 4><i>What we would have liked to cover</i><br> <font size = 6> 1. Networks<br> 2. Bayesian stats<br> 3. Text analysis<br> 4. Statistics<br> 5. Rcpp<br> 6. Forms<br> 7. Github<br> 8. R on servers<br> </font> <br> <font size = 4><i>How to continue</i><br> <font size = 6> 8. Books<br> 9. Websites R<br> 10. Groups<br> </font> ] .pull-right5[ <p align="center"><img src="https://i0.wp.com/www.pieceofk.fr/wp-content/uploads/2017/09/Rplot.png?zoom=2&w=450" width=400 align="center"><br><br> <font size=2>source <a href="https://www.r-bloggers.com/exploring-the-cran-social-network/">R-bloggers.com</a> </p> ] --- # Network analysis A social graph of package Co-authors using `tidyverse` plus `ggraph`, an extension for `ggplot2` for graphs (aka networks) and `igraph`, an extremely powerful network analysis library. Find the code and additional explanation [**here**](https://www.r-bloggers.com/exploring-the-cran-social-network/). .pull-left[ <p align="center"><img src="https://i1.wp.com/www.pieceofk.fr/wp-content/uploads/2017/09/Rplot04.png?zoom=2&w=450" width=450><br> <font size=2>source <a href="https://www.r-bloggers.com/exploring-the-cran-social-network/">R-bloggers.com</a></p> ] .pull-right[ <p align="center"> <br><br> <img src="https://i1.wp.com/www.pieceofk.fr/wp-content/uploads/2017/09/Rplot02.png?zoom=2&w=450" width=450><br><br><br> <font size=2>source <a href="https://www.r-bloggers.com/exploring-the-cran-social-network/">R-bloggers.com</a></p> ] --- # Semantic networks - [**www.swow.me**](https://www.smallworldofwords.org/de) <p align="center"><a href="http://www.swow.me"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/semantic_space.png" width=720></a></p> --- # Text analysis Another area were R has seen much development is **text analysis**. New packages provide access to lightning fast **C++ string libraries**, 'new' data formats such as **html**, **xml**, and **json**, and also to the API of social platforms, such as [**facebook.com**](www.facebook.com) and [**twitter.com**](www.twitter.com). <br><br> | Package| Description| |:------|:------------| | `tm`, `tidytext` | General text analysis packages | | `stringr`, `stringi` | String operations and regular expressions. | | `rvest`, `XML` | Scraping content of the internet| | `text2vec`| Create vector representation of words. | | `SentimentAnalysis`| Sentiment analysis.| | `twitteR`, `streamR`, `jsonlite`| Streaming and parsing tweets. | | `Rfacebook`| Accessing the Facebook API. | --- # Text analysis: Applications .pull-left4[ <p align="center"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/emojis.png" width=450><br> <font size=1>source <a href="http://www.lrec-conf.org/proceedings/lrec2016/pdf/735_Paper.pdf/">Barbieri, F., Ronzano, F., & Saggion, H. (2016, May). What does this Emoji<br>Mean?A Vector Space Skip-Gram Model for Twitter Emojis. In LREC.</a><br>See also my <a href="https://dwulff.github.io/Naturallanguage/">natural language course page</a>.</p> ] .pull-right5[ <br><br2> <p align="center"> <img src="https://spectator.imgix.net/content/uploads/2016/12/GettyImages-607814904.jpg?auto=compress,enhance,format&crop=faces,entropy,edges&fit=crop&w=620&h=413" width=500><br> <font size=2><br>Alexander Nix, Cambridge Analytica<br><font size=1><br>source <a href="https://spectator.imgix.net/content/uploads/2016/12/GettyImages-607814904.jpg?auto=compress,enhance,format&crop=faces,entropy,edges&fit=crop&w=620&h=413">spectator.imgix.net</a></p> ] --- # Text analysis: Applications - [**hedonometer.org**](http://hedonometer.org/books/v1/) <br2> <p align="center"><a href="http://hedonometer.org/books/v1/"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/harry_potter.png" width=900></a><br> <font size=3>Link to <a href="https://arxiv.org/pdf/1606.07772.pdf">Paper</a></font><br> <font size=3>View <a href="https://www.youtube.com/watch?v=oP3c1h8v2ZQ">Vonnegut's Shape of Stories</a></font></p> --- # Stats packages >"If there is a new statistical method, it is first implemented in R" <br> > -- duw <br> | Package| Description| |:------|:------------| | `stats` | Many individual tests plus all the distributions in the world.| | `lme`, `glm` | (Generalized) linear models.| | `lme4`, `afex` | Mixed-mode, hierarchical regression.| | `caret`, `mlr`, `e1071`, `rpart`, etc.| Machine learning.| | `BayesFactor`, `rstanarm`| Bayesian linear models.| | `rjags`, `rstan`| Bayesian graphical models.| | `forecast`, `mgm`, `timeSeries`, etc.| Time series models.| | `cluster`, `fastcluster`, `cstab`, etc.| Cluster analysis.| --- # Deep learning <img src="https://cdn-images-1.medium.com/max/1600/1*R9Vd96dBUU2fJO9dnK0igA.png"> --- # Deep learning: Tensorflow .pull-left5[ ```r # Get Keras install.packages(keras) library(keras) install_keras() # Define model model <- keras_model_sequential() model %>% layer_dense(units = 256, activation = 'relu', input_shape = c(784)) %>% layer_dropout(rate = 0.4) %>% layer_dense(units = 128, activation = 'relu') %>% layer_dropout(rate = 0.3) %>% layer_dense(units = 10, activation = 'softmax') ``` ] .pull-right45[ <a href="https://tensorflow.rstudio.com/"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/TensorFlowLogo.svg/2000px-TensorFlowLogo.svg.png" height = 400></a> ] --- # Bayesian statistics .pull-left5[ Recent years several convenient and efficient packages for **Bayesian statistics** have been developed, facilitating a shift to a more informative and consistent statistical framework. <br><br2> Using these packages is oftentimes **as easy as using their Frequentist counterparts**. See in particular the [**BayesFactor**](http://bayesfactorpcl.r-forge.r-project.org/) package. <br> <p align="center"> <img src="http://www.labtimes.org/labtimes/method/methods/img/2011_04b.jpg" width=350><br> <font size=2>source <a href="http://www.labtimes.org/labtimes/method/methods/img/2011_04b.jpg/">labtimes.org</a></p> ] .pull-right45[ ```r # load package library(BayesFactor) # define data x <- rnorm(100, 0, 1) y <- rnorm(100, 1, 1) # run Frequentist analysis t.test(x, y) # run Bayesian analysis ttestBF(x, y) ``` ``` ## Warning: package 'Matrix' was built under R version 3.4.4 ``` ``` ## Bayes factor analysis ## -------------- ## [1] Alt., r=0.707 : 5914249 ±0% ## ## Against denominator: ## Null, mu1-mu2 = 0 ## --- ## Bayes factor type: BFindepSample, JZS ``` ] --- # Rcpp By now one of the most referenced R packages is Rcpp - **R's interface to C++**. With often relatively little effort due to **Rcpp sugar**, Rcpp can provide vast speed improvements, which many packages today rely on Rcpp in the background for **swift code execution**. Rcpp becomes particularly powerful, when supplemented with `BH`, which makes avaialble a collection **free, peer-reviewed C++ libraries**, and [RcppArmdillo](http://arma.sourceforge.net/), which available the high-performance *Armadillo* library for linear algebra methods. .pull-left4[ <p align="center"> <img src="https://classic105.s3.amazonaws.com/wp-content/uploads/2017/05/180207142-sugar.jpg" width=350><br> <font size=2>source <a href="https://classic105.s3.amazonaws.com/wp-content/uploads/2017/05/180207142-sugar.jpg/">classic105.com</a></p> ] .pull-right6[ <p align="center"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/Rcpp.png" width=480><br><br2> <font size=2><a href="http://dirk.eddelbuettel.com/code/rcpp/Rcpp-quickref.pdf">Quick Reference Guide</a></p> ] --- .pull-left5[ # Google Forms & Maps New packages also allow you to interact with [Google Maps](https://www.google.com/maps) and [Google Forms](https://docs.google.com/forms). Use `ggmap` to access Google Maps and `googlesheets` to access Google Forms. ```r library(ggmap) ggmap(get_map(c(7.588576, 47.559601),zoom=16)) ``` <p align="center"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/basel.png" width=350></p> ] .pull-right45[ <p align="center"><br><br><iframe src="https://docs.google.com/forms/d/e/1FAIpQLSdYMfL36Dcs7IJ4DQh-XGUI0DYHsP0b8taF3jFahs2ZPilySQ/viewform?embedded=true" width="430" height="550">Wird geladen...</iframe></p> ] --- # Github & Dropbox An important part of programming is to **keep track of the progress** to potential be able to go back to an earlier version of the code. To achieve this, many programmers rely on version-control software such as [**GitHub**](www.github.com). R and, in particular, RStudio work have inbuilt software that allow you to **sync your project** with an **GitHub repository**. Via the package called `rdrop2`, R also interfaces with the popular cloud service [**Dropbox**](www.dropbox.com), which also allows for rudimentary version control. .pull-left3[ <p align="left"> <img src="http://forum.copernic.com/wp-content/uploads/2015/04/dropbox-logos_dropbox-vertical-blue.png" width=200></p> ] .pull-right7[ <p align="center"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/github.png" width=265> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/rstudiogit.png" width=380></p> ] --- # R on servers With the need for more computing power for, e.g., machine learning, R is also moving more and more to the **server and cluster sphere**. Rstudio offers a convenient (and free) solution to access [**RStudio**](https://www.rstudio.com/products/rstudio/) sessions on a **remote linux server** via a browser. RStdudio also offers the `sparklyr` package integrating the [**Spark**](https://spark.apache.org/) architecture for efficient cluster computing with `dplyr`. Other packages exist to interface with [**Hadoop**](http://hadoop.apache.org/) (`RHadoop`) and [**SQL**](https://de.wikipedia.org/wiki/SQL) (`RSQLite`). .pull-left6[ <p align="left"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/rstudiologin.png" width=435></p> ] .pull-right4[ <p align="left"> <img src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/rserver_square.png" width=330> ] --- # How to continue .pull-left5[ <font size = 4><i> <font size = 6> 1. Practice<br> 2. Read books<br> 3. Consult websites<br> 4. Attend R group<br> 5. Get consulting<br> ] </font> <br> .pull-right5[ <p align="center"><img border="0" alt="W3Schools" src="http://www.theunmanageableemployee.com/wp-content/uploads/2011/07/5cs-stones-cropped-11052730.jpg?w=112"></p> ] --- # Books Here is a very incomplete series of good books. They are ordered by complexity, beginning with user-friendly books on **learning statistics** in R and ending with books focusing on the more **advanced topics of the R language**. <table width="100%" style="cellspacing:0; cellpadding:0; border:none"> <tr> <td> <a href="https://bookdown.org/ndphillips/YaRrr/"><img border="0" alt="W3Schools" src="https://bookdown.org/ndphillips/YaRrr/images/YaRrr_Cover.jpg" height="180"></a> </td> <td> <a href="https://uk.sagepub.com/en-gb/eur/change-location/0"><img border="0" alt="W3Schools" src="http://t3.gstatic.com/images?q=tbn:ANd9GcSbjn-7l52NdtNguTjP85sJ7QOTVTo5OegVC8bOrS34QSBucXCW" height="180" ></a> </td> <td> <a href="http://r4ds.had.co.nz/"><img border="0" alt="W3Schools" src="http://r4ds.had.co.nz/cover.png" height="180"></a> </td> <td> <a href="https://covers.oreillystatic.com/images/0636920028574/cat.gif"><img border="0" alt="W3Schools" src="https://covers.oreillystatic.com/images/0636920028574/cat.gif" height="180"></a> </td> <td> <a href="http://ggplot2.org/book/"><img border="0" alt="W3Schools" src="http://t1.gstatic.com/images?q=tbn:ANd9GcQNvhEpXp9OwvqVosEh-UecM3TNbhdb1eVZp3LywUcXGeVC3scQ" height="180"></a> </td> <td> <a href="https://www.tidytextmining.com/"><img border="0" alt="W3Schools" src="https://www.tidytextmining.com/images/cover.png" height="180" ></a> </td> <td> <a href="http://appliedpredictivemodeling.com/"><img border="0" alt="W3Schools" src="http://static1.squarespace.com/static/51156277e4b0b8b2ffe11c00/t/51157487e4b0b8b2ffe16829/1509217882069/?format=1500w" height="180" ></a> </td> <td> <a href="http://www-bcf.usc.edu/~gareth/ISL/ISLR%20First%20Printing.pdf"><img border="0" alt="W3Schools" src="https://images-na.ssl-images-amazon.com/images/I/41EaH4W9LVL._SX332_BO1,204,203,200_.jpg" height="180" ></a> </td> </tr> <tr> <td> <a href="https://www.amazon.com/Doing-Bayesian-Data-Analysis-Second/dp/0124058884"><img border="0" alt="W3Schools" src="http://t1.gstatic.com/images?q=tbn:ANd9GcTRRlqFPDLuz1b1FRqtL_bcVrILqPEJgh17piFhG-zwXYN_nCWm" height="180" ></a> </td> <td> <a href="https://www.manning.com/books/deep-learning-with-r"><img border="0" alt="W3Schools" src=" http://t2.gstatic.com/images?q=tbn:ANd9GcTfqjySUegtFHmrss1s042VPMfeotHpu1VZFSrOtGz0N-K3EsiB" height="180" ></a> </td> <td> <a href="https://csgillespie.github.io/efficientR/"><img border="0" alt="W3Schools" src="https://csgillespie.github.io/efficientR/figures/f0_web.png" height="180" ></a> </td> <td> <a href="www.rcpp.org/"><img border="0" alt="W3Schools" src="http://t3.gstatic.com/images?q=tbn:ANd9GcSO9T6JQYtpQgcaCXudbqMB-fnvTjGowsnmeh9-BQku3zveR4-J" height="180" ></a> </td> <td> <a href="https://www.wiley.com/en-us/The+R+Book%2C+2nd+Edition-p-9780470973929"><img border="0" alt="W3Schools" src="https://media.wiley.com/product_data/coverImage300/27/04709739/0470973927.jpg" height="180" ></a> </td> <td> <a href="http://adv-r.had.co.nz/"><img border="0" alt="W3Schools" src="https://images.tandf.co.uk/common/jackets/amazon/978146658/9781466586963.jpg" height="180" ></a> </td> <td> <a href="http://r-pkgs.had.co.nz/"><img border="0" alt="W3Schools" src="http://t3.gstatic.com/images?q=tbn:ANd9GcQdwOQxaWZnTc2s55ltS2NL8jpxbnD0sEC6QNPiHKPrIM-AHmAB" height="180" ></a> </td> <td> <a href="https://images-na.ssl-images-amazon.com/images/I/41eCbcQARTL._SX342_BO1,204,203,200_.jpg"><img border="0" alt="W3Schools" src="https://images-na.ssl-images-amazon.com/images/I/41eCbcQARTL._SX342_BO1,204,203,200_.jpg" height="180" ></a> </td> </tr> </table> <br> --- .pull-left4[ # Websites The web is a great place to learn about R. <font size = 4><i>Best begin your journey with:</i></font> [**Google**](www.google.com) or [**Rseek**](www.rseek.org), which is a wrapper around google to maximize hits related to R. However, most of the time Google works just fine. Just be sure to add *r* to the the search query. <font size = 4><i>Then you will most likely be redirected to one of two pages</i></font> [**R-bloggers**](www.r-bloggers.com) is a website on which R users inform each other on the newest developments. See, e.g., Nathaniel's [entry](https://www.r-bloggers.com/the-new-and-improved-pirateplot-now-with-themes/). [**Stackoverflow**](www.r-bloggers.com) is a website on which R users exchange problems and solutions to problems. Try post something yourself. You will be amazed by the turnaround. ] .pull-right5[ <p align="left" style="padding: 0 0px"><br><br><br><br><br><br><br><br><br> <a href="https://www.google.com/"><img border="0" alt="W3Schools" src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/google.png" height="100"></a><img border="0" alt="W3Schools" src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/comma.png" height="50"><a href="http://rseek.org/"><img border="0" alt="W3Schools" src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/rseek.png" height="100" style="margin-left:10px; margin-buttom:10px"></a><br><br><br><br> <a href="https://www.r-bloggers.com/"><img border="0" alt="W3Schools" src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/rbloggers.png" height="105" style="margin-bottom:10px"></a><br> <a href="https://stackoverflow.com/"><img border="0" alt="W3Schools" src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/stackoverflow.png" height="105"></a> </p> ] --- # R meetup groups Great place to meet other **R enthusiast** in and outside of industry and see interesting presentions on **R's latest developments**. .pull-left5[ <p align="left"> <a href="https://www.meetup.com/de-DE/BaselR/"><img border="0" alt="W3Schools" src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/baselr.png" height="400"></a> ] .pull-right5[ <p align="left"> <a href="https://www.meetup.com/de-DE/Zurich-R-User-Group/?chapter_analytics_code=UA-94107719-1"><img border="0" alt="W3Schools" src="https://raw.githubusercontent.com/therbootcamp/therbootcamp.github.io/master/_sessions/_image/zurichr.png" height="400"></a> ] --- # Consulting Feel free to contact us. <table class="tg" style="cellspacing:0; cellpadding:0; border:none"> <tr> <th class="tg-yw4l"> <p align="center"><br> <a href="www.dirkwulff.org"><img border="0" alt="W3Schools" src="https://www.mpib-berlin.mpg.de/sites/default/files/imagecache/marginal/dirk_wulff2smallnarrow.jpg" height="230"></a><br> <p align="center"> <font size = 5>Dr. Dirk Wulff</font><br><br> <a href="www.dirkwulff.org"><b>dirkwulff.org</b></a><br> <a href="https://github.com/dwulff"><b>github.com/dwulff</b></a><br> <font size=4><i>packages: </i></font> <a href="https://cran.r-project.org/web/packages/cstab/index.html"><b>cstab</b></a>, <br> <a href="https://cran.r-project.org/web/packages/mousetrap/index.html"><b>mousetrap</b></a>, <a href="https://github.com/dwulff/choicepp"><b>choicepp</b> </p> </th> <th class="tg-yw4l"><p align="center"><br> <a href="www.nathanieldphillips.com/"><img border="0" alt="W3Schools" src="https://avatars3.githubusercontent.com/u/8480980?v=4&s=460" height="230"></a><br> <p align="center"> <font size = 5>Dr. Nathaniel Phillips</font><br><br> <a href="www.nathanieldphillips.com/"><b>nathanieldphillips.com</b></a><br> <a href="https://github.com/ndphillips"><b>github.com/ndphillips</b></a><br> <font size=4><i>packages: </i></font> <a href="https://github.com/ndphillips/yarrr"><b>yarrr</b></a>, <br> <a href="https://github.com/ndphillips/FFTrees"><b>FFTrees</b></a></th> <th class="tg-yw4l"><p align="center"> <p align="center"><br> <a href="https://psychologie.unibas.ch/de/personen/markus-steiner/about-me/"><img border="0" alt="W3Schools" src="https://avatars0.githubusercontent.com/u/26483702?s=400&u=d2bfbcee6585b175144fbd2cb17d1bab9a2bac05&v=4" height="230"></a><br> <p align="center"> <font size = 5>Markus Steiner</font><br><br> <a href="https://github.com/mdsteiner"><b>github.com/mdsteiner</b></a><br> <font size=4><i>package: </i></font> <a href="https://github.com/ndphillips/ShinyPsych"><b>ShinyPsych</b> <br><br><br> </p></th></tr> </table> --- .pull-left3[ # Thank you ] .pull-right5[ <p align="center"><br> <a href="http://i.imgur.com/PgtvQar.png"><img border="0" alt="W3Schools" src="http://i.imgur.com/PgtvQar.png" height="560"></a><br> <font size = 4> source <a href="http://i.imgur.com/PgtvQar.png"> reddit.com</a> </p> ]