R Views
https://rviews.rstudio.com/
Recent content on R ViewsHugo -- gohugo.ioen-usTue, 04 Jan 2022 00:00:00 +0000Interview with Oscar Baruffa, Creator of the Big Book of R
https://rviews.rstudio.com/2022/01/04/interview-with-oscar-baruffa/
Tue, 04 Jan 2022 00:00:00 +0000https://rviews.rstudio.com/2022/01/04/interview-with-oscar-baruffa/
<p>Welcome to the new year! If you’re itching to improve your R skills in 2022, we have the resource for you.</p>
<p>We’re excited to share the <a href="https://www.bigbookofr.com/">Big Book of R</a>. “Your last-ever bookmark”, the Big Book of R is an impressive collection of R-related books from a variety of subjects. Creator <a href="https://twitter.com/OscarBaruffa">Oscar Baruffa</a> first published the book in August 2020. Since then, it has grown from a list of 80 to over 200, garnering 73,000 unique visitors and 195,000 pageviews from readers around the globe.</p>
<p>The Book is organized by different subjects that range from <a href="https://www.bigbookofr.com/new-to-r-start-here.html">introduction to R programming</a> to <a href="https://www.bigbookofr.com/big-data.html">big data</a> to <a href="https://www.bigbookofr.com/archeology.html">archeology</a>. Its organization and search functionality make it easy for newcomers to find books related to their topic of interest.</p>
<p><img src="num_books.png" alt="Bar chart of the books by section in the Big Book of R" /></p>
<p>The Big Book of R is a wonderful example of collaboration in the R Community. Oscar wrote the book using the <a href="https://bookdown.org/">bookdown</a> package. Contributors can file an issue or create a pull request on <a href="https://github.com/oscarbaruffa/BigBookofR">Github</a>. And of course, the book would not be possible without the authors who have written books to guide others on their R journey.</p>
<p>While you are preparing for 2022, we encourage you to cozy up to one of the great books in the Big Book of R.</p>
<ul>
<li>Check out the <a href="https://www.bigbookofr.com/">Big Book of R</a></li>
<li>Contribute to the <a href="https://github.com/oscarbaruffa/BigBookofR">Github Repository</a></li>
<li>Follow <a href="https://twitter.com/OscarBaruffa">Oscar on Twitter</a></li>
<li>Subscribe to the <a href="https://oscarbaruffa.com/newsletter/">newsletter</a></li>
</ul>
<h2 id="interview-with-oscar">Interview with Oscar</h2>
<p><strong>Hello! Could you tell us a bit about yourself, please?</strong></p>
<p>I’m a South African now living in the Netherlands, working as a Data Specialist in an international development non-profit focused on sustainable trade systems. My role is basically that of a senior analytics manager and I’m the first one, so I get to have all the fun directing the development of our data pipeline! No really, it’s a lot of fun :).</p>
<p>I studied Mechanical Engineering in my undergraduate and masters degrees and have been dabbling in tech-related side projects and hobbies for many years.</p>
<p><strong>How did you get started with the R Community?</strong></p>
<p>I think it was sometime in late 2018 when I was busy learning a bit of Python and <a href="https://twitter.com/kierisi">Jesse Mostipak</a> started popping up on my Twitter feed. She made R sound quite fun so I thought I’d give it a try. After I got to the exercise in <a href="https://r4ds.had.co.nz/">R for Data Science</a> by <a href="https://twitter.com/hadleywickham">Hadley Wickham</a> and <a href="https://twitter.com/StatGarrett">Garrett Grolemund</a> where you’re introduced to <a href="https://r4ds.had.co.nz/data-visualisation.html#facets">faceting a plot</a>, my mind was blown and I was hooked.</p>
<p>I then started participating in the <a href="https://github.com/rfordatascience/tidytuesday">#TidyTuesday</a> challenge and recorded some screencasts on my “<a href="https://www.youtube.com/c/OtherPeoplesRstats">Other People’s RStats</a>” YouTube channel. I took a bit of a leap of faith submitting a <a href="https://youtu.be/AXYst7P1i3s">lightning talk</a> for <a href="https://satrdays.org/">satRday</a> Johannesburg in April 2019, which was being organised by <a href="https://twitter.com/datawookie">Andrew Collier</a> and <a href="https://twitter.com/mbeckett_za">Megan Beckett</a>. I was selected, which was a welcome surprise for my little topic. They were so helpful when I was trying to figure out the pull request flow for submitting my presentation. I also attended my first-ever R workshop the day before (which Andrew presented), which was the first time I’d ever sat in a room with other people who love R. It was awesome!</p>
<p>While doing all of this, I was also following more and more people on Twitter who were tweeting about R, collecting bookmarks of packages, tutorials, and, of course, books. I was having a lot of fun. By early 2020, I wrote my first book with<a href="https://twitter.com/veerlevanson"> Veerle van Son</a> called <a href="https://www.t4rstats.com/">Twitter for R Programmers</a> as a way to introduce others to the R community on the social platform. So by that point, you could say I’d become heavily invested in the community :).</p>
<p><strong>What inspired you to start the Big Book of R?</strong></p>
<p>I had been diligently collecting bookmarks of books as I was finding them. After about 2 years of doing so, I had an inkling that I must have a large collection. One day, I counted about 80. I compared it to other lists of books that I’d seen published and I had way more, so I figured this might be quite unique to have so many.</p>
<p>Having had written my own short book, I also appreciated how much effort it took and I felt there must be better usability for readers and discoverability for authors if books were all listed in one place and grouped by topic (I invented a library - haha!). I also hoped (still do) that it might encourage more writing too. I put all the books together, spent some time categorising them, and in August 2020 published it. It made quite a splash!</p>
<p><strong>Tell us about the design choices you made to make the book inclusive and open to the community.</strong></p>
<p>I opted to use <a href="https://bookdown.org/">bookdown</a> and git as I already had a bit of experience using them for <a href="https://www.t4rstats.com/">Twitter for R Programmers</a>. It felt very “meta” and fitting to use bookdown, which had in turn been used for almost all of the books in the collection. I was hoping this format would allow others to submit books as well — and they’ve <a href="https://www.bigbookofr.com/index.html#contributors">generously done so</a>. I kept the collection as a plain text format in the hope that it would slightly lower the barrier to people submitting books, but in the end, many people just tag me in a tweet which is welcome :).</p>
<p><strong>What has surprised you the most about this project?</strong></p>
<p>I knew people would like this but I didn’t expect how much it would be appreciated. Every now and then, I get a message of thanks for creating and maintaining it that really makes me feel warm and fuzzy inside. I hope people also reach out to the authors and do the same. Their effort in writing these books is immense and a little bit of appreciation will make their day — guaranteed!</p>
<p>What also surprises me is how there’s very consistent spikes in views and a steady growth in daily visitors whenever someone else shares the Big Book of R. If you’re interested to see the analytics, I’ve made them <a href="https://www.bigbookofr.com/index.html#live-stats">publicly accessible</a>.</p>
<p><strong>What’s in store for the Big Book of R in 2022?</strong></p>
<p>I’m sure the collection will keep growing :).</p>
<p>I’ve just remodeled how the content is generated. Instead of capturing the book entries directly into markdown, it’s now generated by reading the data from a <a href="https://docs.google.com/spreadsheets/d/1vufdtrIzF5wbkWZUG_HGIBAXpT1C4joPx2qTh5aYzDg/edit#gid=2112909599">Google sheet</a>. This new setup gives me the flexibility to do things like alphabetize the books more easily, add additional fields and tags more easily, set up Twitter/LinkedIn bots to automatically post about books in the collection, set up scripts to detect book updates, etc. Basically, I want to open up more possibilities for further automation and discoverability. If anyone is building anything using this data, <a href="https://twitter.com/OscarBaruffa">I’d love to hear about it</a>.</p>
<p>If anyone has ideas of how to improve, please get in touch with me or submit an issue in the <a href="https://github.com/oscarbaruffa/BigBookofR">repo</a>.</p>
<p><strong>Do you have any ongoing or upcoming projects you’d like the R Community to know about?</strong></p>
<p>If things work out, there’s a chance I’ll be a technical reviewer on two R books being worked on in 2022, so that’ll be a new experience for me that I’m looking forward to. I’m going to keep writing useful articles about R, data and data careers over on <a href="https://oscarbaruffa.com/">my blog </a>(and releasing fun R-related products here and there). The best way to be notified of those is to sign up to my <a href="https://oscarbaruffa.com/newsletter/">newsletter</a>. I’m also looking to write some more on the topic of Project Management to build upon my other bit of work that I’m really proud of, <a href="https://oscarbaruffa.com/pm/">Project Management Fundamentals for Data Analysts</a>.</p>
<p><strong>Closing question: what is your favorite R package right now?</strong></p>
<p>I think I’d give that accolade to {dplyr}! I’m pretty sure that <code>filter()</code> and <code>group_by()</code> are my most-used functions. Nothing gives me greater pleasure than a good <code>anti_join()</code>.</p>
<p><em>We at RStudio would like to thank Oscar for his contribution to RViews and the creation of a great resource for the R Community. Happy reading in 2022!</em></p>
<script>window.location.href='https://rviews.rstudio.com/2022/01/04/interview-with-oscar-baruffa/';</script>
November 2021: "Top 40" New CRAN Packages
https://rviews.rstudio.com/2021/12/21/november-2021-top-40-new-cran-packages/
Tue, 21 Dec 2021 00:00:00 +0000https://rviews.rstudio.com/2021/12/21/november-2021-top-40-new-cran-packages/
<p>Two hundred eleven new packages made it to CRAN in November. Here are my “Top 40” picks in thirteen categories: Computational Methods, Data, Ecology, Finance, Genomics, Humanities, Machine Learning, Medicine, Networks, Statistics, Time Series, Utilities, and Visualization. It was gratifying to see multiple packages developed for applications in the Computational Humanities. R is helping to extend the reach of data literacy.</p>
<h3 id="computational-methods">Computational Methods</h3>
<p><a href="https://cran.r-project.org/package=bigQF">bigQF</a> v1.6: Implements a computationally efficient leading-eigenvalue approximation to tail probabilities and quantiles of large quadratic forms (e.g. in the sequence kernel association test) and also provides stochastic singular value decomposition for dense or sparse matrices. See <a href="https://onlinelibrary.wiley.com/doi/10.1002/gepi.22136">Lumley et al. (2018)</a> for background and the vignettes: <a href="https://cran.r-project.org/web/packages/bigQF/vignettes/check-vs-SKAT-2.html">Checking pQF vs SKAT</a>, <a href="https://cran.r-project.org/web/packages/bigQF/vignettes/matrix-free.html">Matrix-free computations</a>, <a href="https://cran.r-project.org/web/packages/bigQF/vignettes/skat-proj.html">SKAT, weights, and projections</a>.</p>
<p><a href="https://cran.r-project.org/package=LMMsolver">LMMsolver</a> v1.0.0: Implements an efficient system to solve sparse, mixed model equations. See the <a href="https://cran.r-project.org/web/packages/LMMsolver/vignettes/Solving_Linear_Mixed_Models.html">vignette</a>.</p>
<p><img src="LMMsolver.png" height = "300" width="500" alt="Heat map of precipitation anomalies"></p>
<p><a href="https://cran.r-project.org/package=nimbleAPT">nimbleAPT</a> v1.0.4: Provides functions for <a href="https://www.tandfonline.com/doi/abs/10.1080/10618600.2013.778779">adaptive parallel tempering</a> with <code>nimble</code> models. See <a href="https://link.springer.com/article/10.1007%2Fs11222-015-9579-0">Lacki & Miasojedow (2016)</a> and the <a href="https://cran.r-project.org/web/packages/nimbleAPT/vignettes/nimbleAPT-vignette.html">vignette</a> to get started.</p>
<p><img src="nimbleAPT.png" height = "300" width="400" alt="Plot of jumps and samples"></p>
<h3 id="data">Data</h3>
<p><a href="https://cran.r-project.org/package=binancer">binancer</a> v1.2.0: Implements an R client to the <a href="https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md">Binance Public Rest API</a> for data collection on cryptocurrencies, portfolio management and trading. See <a href="https://cran.r-project.org/web/packages/binancer/readme/README.html">README</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=japanstat">japanstat</a> v0.1.0: Provides tools for using the API of <a href="https://www.e-stat.go.jp/">e-Stat</a>, a portal site for Japanese government statistics which include functions for automatic query generation, data collection and formatting. See <a href="https://cran.r-project.org/web/packages/japanstat/readme/README.html">README</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=openeo">openeo</a> v1.1.0: Provides to access data and processing for <a href="https://github.com/Open-EO/openeo-r-client">openEO</a> compliant back-ends. See the <a href="https://cran.r-project.org/web/packages/openeo/vignettes/getting_started.html">vignette</a> to get started.</p>
<h3 id="ecology">Ecology</h3>
<p><a href="https://cran.r-project.org/package=mFD">mFD</a> v1.0.1: Provides functions to compute functional traits-based distances between pairs of species for species gathered in assemblages. <a href="https://esajournals.onlinelibrary.wiley.com/doi/10.1002/ecm.1343">Chao et al. (2018)</a> and <a href="https://onlinelibrary.wiley.com/doi/10.1111/geb.12299">Mouillot et al. (2013)</a> along with the other references listed for background. There are five vignettes including <a href="https://cran.r-project.org/web/packages/mFD/vignettes/mFD_general_workflow.html">General Workflow</a> and <a href="https://cran.r-project.org/web/packages/mFD/vignettes/Compute_and_interpret_quality_of_functional_spaces.html">Compute and Interpret Quality of Functional Spaces</a></p>
<p><img src="mFD.png" height = "300" width="500" alt="Plots of trait differences"></p>
<p><a href="https://cran.r-project.org/package=popbayes">popbayes</a> v1.0: Implements a Bayesian framework to infer the trends of animal populations over time from series of counts by accounting for count precision, smoothing the population rate of increase over time, and accounting for the maximum demographic potential of species. There is a <a href="https://cran.r-project.org/web/packages/popbayes/vignettes/popbayes.html">Get started</a> vignette and another on <a href="https://cran.r-project.org/web/packages/popbayes/vignettes/generate_data.html">Getting species information</a>.</p>
<p><img src="popbayes.png" height = "300" width="500" alt="Plot of population size over time"></p>
<h3 id="finance">Finance</h3>
<p><a href="https://onlinelibrary.wiley.com/doi/10.1111/jofi.12131">MultiATSM</a> v0.0.1: Provides functions to model the affine term structure of interest rates based on the single-country unspanned macroeconomic risk framework of <a href="https://www.sciencedirect.com/science/article/abs/pii/S0304405X14001883?via%3Dihub">Joslin et al. (2014)</a> and the multi country extensions of <a href="https://doi.org/10.1016%2Fj.jfineco.2014.09.004">Jotikasthira et al.(2015)</a>, and <a href="https://dial.uclouvain.be/pr/boreal/object/boreal:249985">Candelon and Moura (2021)</a>. See the <a href="https://cran.r-project.org/web/packages/MultiATSM/vignettes/my-vignette.html">vignette</a> for an example.</p>
<p><img src="MultiATSM.png" height = "300" width="400" alt="Plot of level, slope and curvature by maturity years"></p>
<h3 id="genomics">Genomics</h3>
<p><a href="https://cran.r-project.org/package=gwasrapidd">gwasrapidd</a> v0.99.12: Provides easy access to the NHGRI-EBI <a href="https://www.ebi.ac.uk/gwas/">GWAS Catalog</a> via the <a href="https://www.ebi.ac.uk/gwas/rest/docs/api/">REST API</a>. There is a <a href="https://cran.r-project.org/web/packages/gwasrapidd/vignettes/gwasrapidd.html">Getting Started Guide</a>, a vignette on <a href="https://cran.r-project.org/web/packages/gwasrapidd/vignettes/bmi_variants.html">Variants associated with BMI</a>, and an <a href="https://cran.r-project.org/web/packages/gwasrapidd/vignettes/faq.html">FAQ</a>.</p>
<p><img src="gwasrapidd.png" height = "300" width="500" alt="Examples of search criteria"></p>
<p><a href="https://cran.r-project.org/package=phylosamp">phylosamp</a> v0.1.6: Implements tools to estimate the probability of true transmission between two cases given phylogenetic linkage and the expected number of true transmission links in a sample. The methods are described in <a href="https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1009182">Wohl et al. (2021)</a>. There are vignettes on estimating <a href="https://cran.r-project.org/web/packages/phylosamp/vignettes/V1_FalseDicoveryRate.html">FDR from sample size</a>, <a href="https://cran.r-project.org/web/packages/phylosamp/vignettes/V2_SampleSize.html">Sample size from FDR</a>, <a href="https://cran.r-project.org/web/packages/phylosamp/vignettes/V3_SensitivitySpecificity.html">Sensitivity and specificity</a>, and <a href="https://cran.r-project.org/web/packages/phylosamp/vignettes/V4_FullExamples.html">Examples</a>.</p>
<p><img src="phylosamp.png" height = "300" width="500" alt="Histogram of Genetic Distance"></p>
<p><a href="https://cran.r-project.org/package=Rtropical">Rtropical</a> v1.2.1: Provides functions to process phylogenetic trees with tropical support vector machines and principal component analysis defined with tropical geometry. See <a href="https://arxiv.org/abs/2003.00677">Tang et al. (2020)</a> for details about tropical SVMs, <a href="https://academic.oup.com/bioinformatics/article/36/17/4590/5855129">Page et al. (2020)</a> and <a href="https://link.springer.com/article/10.1007%2Fs11538-018-0493-4">Yoshida et al. (2019)</a> for tropical PCA, and <a href="https://arxiv.org/pdf/0706.2920.pdf">Ardila & Develin (2007)</a> for some background on tropical mathematics. The <a href="https://cran.r-project.org/web/packages/Rtropical/vignettes/usage.html">vignette</a> will get you started.</p>
<h3 id="humanities">Humanities</h3>
<p><a href="https://cran.r-project.org/package=litRiddle">litRiddle</a> v0.4.1: Provides a dataset, functions to explore the quality of literary novels, the data of a reader survey about fiction in Dutch, a description of the novels the readers rated, and the results of stylistic measurements of the novels. There is a <a href="https://cran.r-project.org/web/packages/litRiddle/vignettes/litRiddle.html">vignette</a>.</p>
<p><img src="litRiddle.png" height = "400" width="400" alt="Histograms of Literariness by Gender"></p>
<p><a href="https://cran.r-project.org/package=kairos">kairos</a> v1.0.0: Provides a toolkit for absolute dating and analysis of chronological patterns, including functions for chronological modeling and dating of archaeological assemblages from count data. There is a <a href="https://cran.r-project.org/web/packages/kairos/vignettes/kairos.html">Manual</a>, and a <a href="https://cran.r-project.org/web/packages/kairos/vignettes/bibliography.html">Bibliography</a>.</p>
<h3 id="machine-learning">Machine Learning</h3>
<p><a href="https://cran.r-project.org/package=cuda.ml">cuda.ml</a> v0.3.1: Implements an R interface for <a href="https://github.com/rapidsai/cuml">RAPIDS cuML</a>, a suite of GPU-accelerated machine learning libraries powered by <a href="https://en.wikipedia.org/wiki/CUDA">CUDA</a>. Look <a href="https://mlverse.github.io/cuda.ml/">here</a> for an example.</p>
<p><img src="cuda.png" height = "300" width="500" alt="Projection map of manifold embedding"></p>
<p><a href="https://cran.r-project.org/package=innsight">innsight</a> v0.1.1: Implements methods to analyze the behavior and individual predictions of modern neural networks including Connection Weights as described by <a href="https://www.sciencedirect.com/science/article/abs/pii/S0304380004001565?via%3Dihub">Olden et al. (2004)</a>, Layer-wise Relevance Propagation as described by <a href="https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0130140">Bach et al. (2015)</a>, Deep Learning Important Features as described by <a href="https://arxiv.org/abs/1704.02685">Shrikumar et al. (2017)</a>, and gradient-based methods like SmoothGrad described by <a href="https://arxiv.org/abs/1706.03825">Smilkov et al. (2017)</a>, and Gradient x Input described by <a href="https://arxiv.org/abs/0912.1128">Baehrens et al. (2009)</a>. There is an <a href="https://cran.r-project.org/web/packages/innsight/vignettes/innsight.html">Introduction</a> and a vignette on <a href="https://cran.r-project.org/web/packages/innsight/vignettes/Custom_Model_Definition.html">Custom Model Definition</a>.</p>
<p><img src="innsight.png" height = "300" width="500" alt="Heatmap showing feature relevance"></p>
<p><a href="https://cran.r-project.org/package=topicmodels.etm">topicmodels.etm</a> v0.1.0: Provides functions to find topics in texts which are semantically embedded using techniques like <a href="https://en.wikipedia.org/wiki/Word2vec">word2vec</a> or <a href="https://nlp.stanford.edu/projects/glove/">GloVe</a>. See <a href="https://arxiv.org/abs/1907.04907">Dieng et al. (2019)</a> for the details, and look <a href="https://cran.r-project.org/web/packages/topicmodels.etm/readme/README.html">here</a> for an example.</p>
<p><img src="topic.png" height = "300" width="500" alt="Plot of ETM clusters"></p>
<h3 id="medicine">Medicine</h3>
<p><a href="https://cran.r-project.org/package=clustra">clustra</a> v0.1.5: Provides functions to cluster medical trajectories of unequally spaced and unequal length time series aligned by an intervention time. See the <a href="https://cran.r-project.org/web/packages/clustra/vignettes/clustra_vignette.html">vignette</a> for examples.</p>
<p><img src="clustra.png" height = "500" width="400" alt="Plot of trajectories clustered by group"></p>
<p><a href="https://cran.r-project.org/package=eSIR">eSIR</a> v0.4.2: Implements the extended state-space SIR models developed by <a href="http://websites.umich.edu/~songlab/">Song Lab</a> at UM school of Public Health which include capabilities to model time-varying transmission, time-dependent quarantine, and time-dependent antibody-immunization. See <a href="https://jds-online.org/journal/JDS/article/28/info">Wang et al. (2020)</a> for background, and <a href="https://cran.r-project.org/web/packages/eSIR/readme/README.html">README</a> for examples.</p>
<p><img src="eSIR.png" height = "300" width="500" alt="Plot of Probability of infection over time"></p>
<p><a href="https://cran.r-project.org/package=QHScrnomo">QHScrnomo</a> v2.2.0: Provides functions for fitting and predicting competing risk models, creating nomograms, k-fold cross validation, calculating the discrimination metric, and drawing calibration curves. See the <a href="https://cran.r-project.org/web/packages/QHScrnomo/vignettes/introduction.html">vignette</a> for a short tutorial.</p>
<p><img src="QHS.png" height = "300" width="500" alt="Example of a nomogram"></p>
<p><a href="https://cran.r-project.org/package=rnmamod">rnmamod</a> v0.1.0: Implements a comprehensive suite of functions to perform and visualize pairwise and network meta-analyses. The package covers core Bayesian one-stage models implemented in a systematic review with multiple interventions, including fixed-effect and random-effects network meta-analysis. There are vignettes on <a href="https://cran.r-project.org/web/packages/rnmamod/vignettes/perform_network_metaanalysis.html">Performing a network meta-analysis</a> and <a href="https://cran.r-project.org/web/packages/rnmamod/vignettes/network_description.html">Describing the network</a>.</p>
<p><img src="rnmamod.png" height = "300" width="500" alt="Map of network of interventions evaluated"></p>
<p><a href="https://cran.r-project.org/package=whomds">whomds</a> v1.0.1: Provides functions for calculating and presenting the results from the <a href="https://www.who.int/home/cms-decommissioning">WHO</a> Model Disability Survey (<a href="https://www.who.int/publications/i/item/9789241512862">MDA</a>). See <a href="https://www.who.int/publications/i/item/9789241512862">Andrich (2014)</a> for background on Rasch measurement. There are English and Spanish versions of six vignettes including <a href="https://cran.r-project.org/web/packages/whomds/vignettes/c1_background_EN.html">Background on disability measurement</a> and <a href="https://cran.r-project.org/web/packages/whomds/vignettes/c5_best_practices_EN.html">Best practices with Rasch Analysis</a>.</p>
<p><img src="whomds.png" height = "300" width="600" alt="Illustration of disability scores"></p>
<h3 id="networks">Networks</h3>
<p><a href="https://CRAN.R-project.org/package=diffudist">diffudist</a> v1.0.0: Enables the evaluation of diffusion distances for complex single-layer networks by providing functions to evaluate the Laplacians, stochastic matrices, and the corresponding diffusion distance matrices. See <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.118.168301">De Domenico (2017)</a> and <a href="https://journals.aps.org/pre/abstract/10.1103/PhysRevE.103.042301">Bertagnolli & De Domenico (2021)</a> for the details and the <a href="https://cran.r-project.org/web/packages/diffudist/vignettes/diffusion-distances.html">vignette</a> for some theory and examples.</p>
<p><img src="diffudist.png" height = "300" width="500" alt="Hierarchical cluster plots of distances"></p>
<p><a href="https://cran.r-project.org/package=NetFACS">NetFACS</a> V0.3.0: Provides functions to analyze and visualize facial communication data, based on network theory and resampling methods and primarily targeted at datasets of facial expressions coded with the <a href="https://www.paulekman.com/facial-action-coding-system/">Facial Action Coding System</a>. See <a href="https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.12772">Farine (2017)</a> and <a href="https://methods.sagepub.com/book/monte-carlo-simulation-and-resampling-methods-for-social-science">Carsey & Harden (2014)</a> for background, and the <a href="https://cran.r-project.org/web/packages/NetFACS/vignettes/tutorial.html">vignette</a> for an introduction.</p>
<p><img src="NetFACS.png" height = "300" width="500" alt="Network of facial expressions"></p>
<h3 id="statistics">Statistics</h3>
<p><a href="https://cran.r-project.org/package=adass">adass</a> v1.0.0: Implements the adaptive smoothing spline estimator for the function-on-function linear regression model described in <a href="https://arxiv.org/abs/2011.12036">Centofanti et al. (2020)</a>. Look <a href="https://github.com/unina-sfere/adass">here</a> for an example.</p>
<p><img src="adass.png" height = "300" width="500" alt="Heatmap of adaptive spline estimator"></p>
<p><a href="https://cran.r-project.org/package=OneSampleMR">OneSampleMR</a> v0.1.0: Provides functions for one sample Mendelian randomization and instrumental variable analyses including implementations of the <a href="https://www.sciencedirect.com/science/article/pii/S0304407615001736?via%3Dihub">Sanderson & Windmeijer (2016)</a> conditional F-statistic, the multiplicative structural mean model <a href="https://journals.lww.com/epidem/Fulltext/2006/07000/Instruments_for_Causal_Inference__An.4.aspx">Hernán and Robins (2006)</a>, and two-stage predictor substitution and two-stage residual inclusion estimators explained by <a href="https://www.sciencedirect.com/science/article/abs/pii/S0167629607001063?via%3Dihub">Terza et al. (2008)</a>. There are short vignettes on the <a href="https://cran.r-project.org/web/packages/OneSampleMR/vignettes/compare-smm-fits.html">Multiplicative structural mean model</a> and the <a href="https://cran.r-project.org/web/packages/OneSampleMR/vignettes/f-statistic-comparison.html">Coditional F-Statistic</a>.</p>
<p><a href="https://cran.r-project.org/package=PhaseTypeR">PhaseTypeR</a> v1.0.1: Implements functions to model continuous and discrete <a href="https://en.wikipedia.org/wiki/Phase-type_distribution">phase-type distributions</a>, both univariate and multivariate. See <a href="https://orbit.dtu.dk/en/publications/order-statistics-and-multivariate-discrete-phase-type-distributio">Navarro (2019)</a> for background. There is an <a href="https://cran.r-project.org/web/packages/PhaseTypeR/vignettes/PhaseTypeR.html">Introduction</a> and vignettes on <a href="https://cran.r-project.org/web/packages/PhaseTypeR/vignettes/a2_pop_gen_iker.html">Population Genetics</a> and <a href="https://cran.r-project.org/web/packages/PhaseTypeR/vignettes/a3_phasetypeR_SFS.html">The Site Frequency Spectrum</a>.</p>
<p><img src="PhaseTypeR.png" height = "300" width="500" alt="Histogram of Phase Type Distribution"></p>
<p><a href="https://cran.r-project.org/package=stan4bart">stan4bart</a> v0.0-2: Fits semiparametric linear and multilevel models with non-parametric additive Bayesian additive regression trees <a href="https://projecteuclid.org/journals/annals-of-applied-statistics/volume-4/issue-1/BART-Bayesian-additive-regression-trees/10.1214/09-AOAS285.full">BART</a> and <code>Stan</code>. Multilevel models can be expressed using <a href="https://www.jstatsoft.org/article/view/v067i01"><code>lme4</code> syntax</a>. Look <a href="https://github.com/vdorie/stan4bart">here</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=zoid">zoid</a> v1.0.0: Fits Dirichlet regression and zero-and-one inflated Dirichlet regression (also called trinomial mixture models) with Bayesian methods implemented in <code>Stan</code>. There are vignettes on <a href="https://cran.r-project.org/web/packages/zoid/vignettes/a01_fitting.html">Fitting Models</a>, <a href="https://cran.r-project.org/web/packages/zoid/vignettes/a02_simulating.html">Simulating data</a>, <a href="https://cran.r-project.org/web/packages/zoid/vignettes/a03_beta_priors.html">Priors</a>, and <a href="https://cran.r-project.org/web/packages/zoid/vignettes/a04_priors.html">Prior sensitivity for overdispersion</a>.</p>
<h3 id="time-series">Time Series</h3>
<p><a href="https://cran.r-project.org/package=surveil">surveil</a> v0.1.0: Fits time series models for routine disease surveillance tasks and returns probability distributions for a variety of quantities of interest, including measures of health inequality, period and cumulative percent change, and age-standardized rates. See the <a href="https://cran.r-project.org/web/packages/surveil/vignettes/demonstration.html">vignette</a> for an introduction.</p>
<p><img src="surveil.png" height = "300" width="400" alt="Plot time series by race"></p>
<p><a href="https://cran.r-project.org/package=VisitorCounts">VisitorCounts</a> v1.0.0: Provides functions for modeling and forecasting of park visitor counts using social media data and (partial) on-site visitor counts. See <a href="https://www.nature.com/articles/srep02976">Wood et al. (2013)</a> for background and the <a href="https://cran.r-project.org/web/packages/VisitorCounts/vignettes/VisitorCounts.html">vignette</a> for examples.</p>
<p><img src="VisitorCounts.png" height = "300" width="500" alt="Plot of model fits and differences"></p>
<h3 id="utilities">Utilities</h3>
<p><a href="https://cran.r-project.org/package=dateutils">dateutils</a> v0.1.5: Provides utilities for mixed frequency data, in particular, to aggregate and normalize tabular mixed frequency data, index dates to end of period, and seasonally adjust tabular data. There is an <a href="https://cran.r-project.org/web/packages/dateutils/vignettes/intro.html">Introduction</a>.</p>
<p><a href="https://cran.r-project.org/package=datefixR">datefixR</a> v0.1.2: Provides functions to fix messy dates such as those entered via text boxes. Standardizes “/” or “-”, whitespace separation, month abbreviations, and more. See the <a href="https://cran.r-project.org/web/packages/datefixR/vignettes/datefixR.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=lambdr">lambdar</a> v1.1.0: Provides functions for serving containers that can execute R code on the <a href="https://aws.amazon.com/lambda/">AWS Lambda</a> serverless compute service. There are five vignettes including <a href="https://cran.r-project.org/web/packages/lambdr/vignettes/api-gateway-invocations.html">api-gateway-invocations</a> and <a href="https://cran.r-project.org/web/packages/lambdr/vignettes/lambda-runtime-in-container.html">lambda-runtime-in-container</a>.</p>
<p><img src="lambdar.svg" height = "300" width="500" alt="Diagram of package structure"></p>
<p><a href="https://cran.r-project.org/package=mtb">mtb</a> v0.1.1: Provides functions to summarize time related data, generate axis transformation from data, and assist Markdown and Shiny file editing. There are vignettes on working with <a href="https://cran.r-project.org/web/packages/mtb/vignettes/vignette_mtb_axis.html">axes</a>, <a href="https://cran.r-project.org/web/packages/mtb/vignettes/vignette_mtb_color.html">color</a>, <a href="https://cran.r-project.org/web/packages/mtb/vignettes/vignette_mtb_md.html">Markdown</a>, and <a href="https://cran.r-project.org/web/packages/mtb/vignettes/vignette_mtb_timerelated.html">time related data</a>.</p>
<p><img src="mtb.png" height = "300" width="500" alt="Diagram showing arrows associated with times"></p>
<p><a href="https://cran.r-project.org/package=rocker">rocker</a> v0.2.1: Provides an <code>R6</code> class interface for handling database connections using the <code>DBI</code> package as backend which allows handling of connections to <code>PostgreSQL</code>, <code>MariaDB</code>, <code>SQLite</code> and other databases. There are seven short vignettes including <a href="https://cran.r-project.org/web/packages/rocker/vignettes/DBI_objects_and_functions.html">DBI package objects and functions in R6 rocker class</a> and <a href="https://cran.r-project.org/web/packages/rocker/vignettes/Transactions.html">Database transactions with R6 rocker class</a>.</p>
<p><a href="https://cran.r-project.org/package=shinySelect">shinySelect</a> v1.0.0: Provides a customizable, select control widget for <code>Shiny</code> to enable using HTML in the items and <a href="https://katex.org/">KaTeX</a> to type mathematics. Look <a href="https://github.com/stla/shinySelect">here</a> for examples.</p>
<p><img src="katex.gif" height = "300" width="500" alt="Mathematics in Shiny select bar"></p>
<h3 id="visualization">Visualization</h3>
<p><a href="https://cran.r-project.org/package=gggrid">gggrid</a> v0.1-1: Extends<code>ggplot2</code> to make it easy to add raw <code>grid</code> output, such as customised annotations, to a plot. See the <a href="https://cran.r-project.org/web/packages/gggrid/vignettes/gggrid.html">vignette</a> for examples.</p>
<p><img src="gggrid.png" height = "300" width="500" alt="latitude vs. longitude plot"></p>
<p><a href="https://cran.r-project.org/package=NHSRplotthedots">NHSRplotthedots</a> v0.1.0: Provides tools for drawing statistical process control charts with functions to draw <a href="https://www.pqsystems.com/qualityadvisor/DataAnalysisTools/x_mr.php">XmR</a> charts, use change points and apply rules with summary indicators for when rules are breached. There is an <a href="https://cran.r-project.org/web/packages/NHSRplotthedots/vignettes/intro.html">Introduction</a> and vignettes <a href="https://cran.r-project.org/web/packages/NHSRplotthedots/vignettes/deviations.html">Deviations from Excel defaults</a> and <a href="https://cran.r-project.org/web/packages/NHSRplotthedots/vignettes/number-of-points-required.html">Number of points required</a>.</p>
<p><img src="NHSR.png" height = "300" width="500" alt="SPC Charts"></p>
<p><a href="https://cran.r-project.org/package=shinymodels">shinymodels</a> v0.1.0: Allows users to launch a <code>shiny</code> application for <code>tidymodels</code> results. For classification or regression models, the app can be used to determine if there is lack of fit or poorly predicted points. Look <a href="https://github.com/tidymodels/shinymodels">here</a> to get started.</p>
<p><img src="shinymodels.png" height = "300" width="500" alt="Shiny generated scatter plots"></p>
<script>window.location.href='https://rviews.rstudio.com/2021/12/21/november-2021-top-40-new-cran-packages/';</script>
The COVID19 package, an interface to the COVID-19 Data Hub
https://rviews.rstudio.com/2021/12/08/the-r-package-covid19/
Wed, 08 Dec 2021 00:00:00 +0000https://rviews.rstudio.com/2021/12/08/the-r-package-covid19/
<script src="/2021/12/08/the-r-package-covid19/index_files/header-attrs/header-attrs.js"></script>
<script src="/2021/12/08/the-r-package-covid19/index_files/htmlwidgets/htmlwidgets.js"></script>
<script src="/2021/12/08/the-r-package-covid19/index_files/jquery/jquery.min.js"></script>
<link href="/2021/12/08/the-r-package-covid19/index_files/dygraphs/dygraph.css" rel="stylesheet" />
<script src="/2021/12/08/the-r-package-covid19/index_files/dygraphs/dygraph-combined.js"></script>
<script src="/2021/12/08/the-r-package-covid19/index_files/dygraphs/shapes.js"></script>
<script src="/2021/12/08/the-r-package-covid19/index_files/moment/moment.js"></script>
<script src="/2021/12/08/the-r-package-covid19/index_files/moment-timezone/moment-timezone-with-data.js"></script>
<script src="/2021/12/08/the-r-package-covid19/index_files/moment-fquarter/moment-fquarter.min.js"></script>
<script src="/2021/12/08/the-r-package-covid19/index_files/dygraphs-binding/dygraphs.js"></script>
<p><img src="logo.png" style="float:right" height="128" width = "128" /></p>
<p><a href="https://cran.r-project.org/package=COVID19"><img src="https://www.r-pkg.org/badges/version/COVID19" style="display:inline-block"/></a>
<a href="https://cran.r-project.org/package=COVID19"><img src="https://cranlogs.r-pkg.org/badges/last-month/COVID19" style="display:inline-block"/></a>
<a href="https://doi.org/10.21105/joss.02376"><img src="https://joss.theoj.org/papers/10.21105/joss.02376/status.svg" style="display:inline-block"/></a></p>
<p>The <a href="https://covid19datahub.io">COVID-19 Data Hub</a> provides a daily summary of COVID-19 cases, deaths, recovered, tests, vaccinations, and hospitalizations for 230+ countries, 760+ regions, and 12000+ administrative divisions of lower level. It includes policy measures, mobility, and geospatial data. This post presents version 3.0.0 of the <code>COVID19</code> package to seamlessly import the data in R.</p>
<div id="why-another-package-for-covid-19-data" class="section level2">
<h2>Why another package for COVID-19 data</h2>
<p>Many packages now exist to retrieve COVID-19 related data from within R. As an example, <a href="https://cran.r-project.org/package=covid19br">covid19br</a> retrieves case data for Brazil, <a href="https://cran.r-project.org/package=covid19sf">covid19sf</a> for San Francisco, <a href="https://cran.r-project.org/package=covid19us">covid19us</a> for United States, <a href="https://cran.r-project.org/package=covid19india">covid19india</a> for India, <a href="https://cran.r-project.org/package=covid19italy">covid19italy</a> for Italy, <a href="https://cran.r-project.org/package=covid19swiss">covid19swiss</a> for Switzerland, <a href="https://cran.r-project.org/package=covid19france">covid19france</a> for France, and so on. There also other packages, such as <a href="https://cran.r-project.org/package=coronavirus">coronavirus</a>, that retrieve national-level statistics worldwide from the Center for Systems Science and Engineering at Johns Hopkins University (JHU CCSE). However, national counts only represent a small portion of the available governmental data, and having the information scattered across many packages and different interfaces makes international comparisons of large, detailed outbreak data difficult, and prevents
inferences from such data to be effective.</p>
<p><code>COVID19</code> is the official package created around <a href="https://covid19datahub.io">COVID-19 Data Hub</a>: a unified database harmonizing open governmental data around the globe at fine-grained spatial resolution. Moreover, as epidemiological data alone are typically of limited use, the database includes a set of identifiers to match the epidemiological data with exogenous indicators and geospatial information. By unifying the access to the data, this database makes it possible to study the pandemic in its global scale with high resolution, taking into account within-country variations, non pharmaceutical interventions, and environmental and exogenous variables.</p>
<p>In particular, this package allows you to download a large set of <a href="https://covid19datahub.io/articles/docs.html#epidemiological-variables">epidemiological variables</a>, exogenous indicators from <a href="https://data.worldbank.org/">World Bank</a>, mobility data from <a href="https://www.google.com/covid19/mobility/">Google</a> and <a href="https://www.apple.com/covid19/mobility">Apple</a> mobility reports, and geospatial information from <a href="https://ec.europa.eu/eurostat/web/nuts/nuts-maps">Eurostat</a> for Europe or <a href="https://gadm.org/">GADM</a> worldwide, in, literally, one line of code.</p>
</div>
<div id="whats-new-in-version-3.0.0" class="section level2">
<h2>What’s new in version 3.0.0</h2>
<p>Version 3 is a major update of COVID-19 Data Hub, which includes a great improvement in the spatial coverage, new data on vaccines, and a new set of identifiers to enable geospatial analyses. The full changelog is available <a href="https://covid19datahub.io/news/index.html">here</a>.</p>
<p>The large amount of data that is now available (~2GB) has led to some breaking changes in the way the data are provided. Version 3 of the <code>COVID19</code> package is designed to be compatible with the latest version of COVID-19 Data Hub, and process large amount of data at speed with low memory requirements. The documentation and a quick start guide is available <a href="https://covid19datahub.io/articles/r.html">here</a>.</p>
</div>
<div id="data-coverage" class="section level2">
<h2>Data coverage</h2>
<p>The figure shows the granularity and the spatial coverage of the data as of November 27, 2021.</p>
<p><img src="main.png" /></p>
<p>What’s included?</p>
<pre class="r"><code>library(COVID19) # load the package
x <- covid19() # download the data</code></pre>
<p>Refer to the <a href="https://covid19datahub.io/articles/docs.html">documentation</a> for the description of each variable.</p>
<pre class="r"><code>colnames(x)</code></pre>
<pre><code>## [1] "id" "date"
## [3] "confirmed" "deaths"
## [5] "recovered" "tests"
## [7] "vaccines" "people_vaccinated"
## [9] "people_fully_vaccinated" "hosp"
## [11] "icu" "vent"
## [13] "school_closing" "workplace_closing"
## [15] "cancel_events" "gatherings_restrictions"
## [17] "transport_closing" "stay_home_restrictions"
## [19] "internal_movement_restrictions" "international_movement_restrictions"
## [21] "information_campaigns" "testing_policy"
## [23] "contact_tracing" "facial_coverings"
## [25] "vaccination_policy" "elderly_people_protection"
## [27] "government_response_index" "stringency_index"
## [29] "containment_health_index" "economic_support_index"
## [31] "administrative_area_level" "administrative_area_level_1"
## [33] "administrative_area_level_2" "administrative_area_level_3"
## [35] "latitude" "longitude"
## [37] "population" "iso_alpha_3"
## [39] "iso_alpha_2" "iso_numeric"
## [41] "iso_currency" "key_local"
## [43] "key_google_mobility" "key_apple_mobility"
## [45] "key_jhu_csse" "key_nuts"
## [47] "key_gadm"</code></pre>
</div>
<div id="data-transparency" class="section level2">
<h2>Data transparency</h2>
<p>This package applies no pre-processing to the original data, that are provided as-is. The data acquisition pipeline is open source and all the original data providers are listed <a href="https://covid19datahub.io/reference/index.html">here</a>.</p>
<p>As an example, the following code snippet plots the fraction of confirmed cases on a given day per number of tests performed on that day in U.S. Notice that around June 2021, the fraction becomes negative. This is a known issue due to decreasing cumulative counts in the original data provider. This package applies no cleaning procedure for this kind of issues, which are typically due to changes in the data collection methodology. If the provider corrects the data retroactively, the changes are reflected in this package.</p>
<pre class="r"><code>library(xts)
library(dygraphs)
x <- covid19("USA", verbose = FALSE) # download the data
ts <- xts(x[,c("confirmed", "tests")], order.by = x$date) # convert to an xts object
ts$ratio <- diff(ts$confirmed) / diff(ts$tests) # compute daily ratio
dygraph(ts$ratio, main = "Daily fraction confirmed/tests in U.S.") # plot</code></pre>
<div id="htmlwidget-1" style="width:672px;height:480px;" class="dygraphs html-widget"></div>
<script type="application/json" data-for="htmlwidget-1">{"x":{"attrs":{"title":"Daily fraction confirmed/tests in U.S.","labels":["day","ratio"],"legend":"auto","retainDateWindow":false,"axes":{"x":{"pixelsPerLabel":60}}},"scale":"daily","annotations":[],"shadings":[],"events":[],"format":"date","data":[["2020-01-21T00:00:00.000Z","2020-01-22T00:00:00.000Z","2020-01-23T00:00:00.000Z","2020-01-24T00:00:00.000Z","2020-01-25T00:00:00.000Z","2020-01-26T00:00:00.000Z","2020-01-27T00:00:00.000Z","2020-01-28T00:00:00.000Z","2020-01-29T00:00:00.000Z","2020-01-30T00:00:00.000Z","2020-01-31T00:00:00.000Z","2020-02-01T00:00:00.000Z","2020-02-02T00:00:00.000Z","2020-02-03T00:00:00.000Z","2020-02-04T00:00:00.000Z","2020-02-05T00:00:00.000Z","2020-02-06T00:00:00.000Z","2020-02-07T00:00:00.000Z","2020-02-08T00:00:00.000Z","2020-02-09T00:00:00.000Z","2020-02-10T00:00:00.000Z","2020-02-11T00:00:00.000Z","2020-02-12T00:00:00.000Z","2020-02-13T00:00:00.000Z","2020-02-14T00:00:00.000Z","2020-02-15T00:00:00.000Z","2020-02-16T00:00:00.000Z","2020-02-17T00:00:00.000Z","2020-02-18T00:00:00.000Z","2020-02-19T00:00:00.000Z","2020-02-20T00:00:00.000Z","2020-02-21T00:00:00.000Z","2020-02-22T00:00:00.000Z","2020-02-23T00:00:00.000Z","2020-02-24T00:00:00.000Z","2020-02-25T00:00:00.000Z","2020-02-26T00:00:00.000Z","2020-02-27T00:00:00.000Z","2020-02-28T00:00:00.000Z","2020-02-29T00:00:00.000Z","2020-03-01T00:00:00.000Z","2020-03-02T00:00:00.000Z","2020-03-03T00:00:00.000Z","2020-03-04T00:00:00.000Z","2020-03-05T00:00:00.000Z","2020-03-06T00:00:00.000Z","2020-03-07T00:00:00.000Z","2020-03-08T00:00:00.000Z","2020-03-09T00:00:00.000Z","2020-03-10T00:00:00.000Z","2020-03-11T00:00:00.000Z","2020-03-12T00:00:00.000Z","2020-03-13T00:00:00.000Z","2020-03-14T00:00:00.000Z","2020-03-15T00:00:00.000Z","2020-03-16T00:00:00.000Z","2020-03-17T00:00:00.000Z","2020-03-18T00:00:00.000Z","2020-03-19T00:00:00.000Z","2020-03-20T00:00:00.000Z","2020-03-21T00:00:00.000Z","2020-03-22T00:00:00.000Z","2020-03-23T00:00:00.000Z","2020-03-24T00:00:00.000Z","2020-03-25T00:00:00.000Z","2020-03-26T00:00:00.000Z","2020-03-27T00:00:00.000Z","2020-03-28T00:00:00.000Z","2020-03-29T00:00:00.000Z","2020-03-30T00:00:00.000Z","2020-03-31T00:00:00.000Z","2020-04-01T00:00:00.000Z","2020-04-02T00:00:00.000Z","2020-04-03T00:00:00.000Z","2020-04-04T00:00:00.000Z","2020-04-05T00:00:00.000Z","2020-04-06T00:00:00.000Z","2020-04-07T00:00:00.000Z","2020-04-08T00:00:00.000Z","2020-04-09T00:00:00.000Z","2020-04-10T00:00:00.000Z","2020-04-11T00:00:00.000Z","2020-04-12T00:00:00.000Z","2020-04-13T00:00:00.000Z","2020-04-14T00:00:00.000Z","2020-04-15T00:00:00.000Z","2020-04-16T00:00:00.000Z","2020-04-17T00:00:00.000Z","2020-04-18T00:00:00.000Z","2020-04-19T00:00:00.000Z","2020-04-20T00:00:00.000Z","2020-04-21T00:00:00.000Z","2020-04-22T00:00:00.000Z","2020-04-23T00:00:00.000Z","2020-04-24T00:00:00.000Z","2020-04-25T00:00:00.000Z","2020-04-26T00:00:00.000Z","2020-04-27T00:00:00.000Z","2020-04-28T00:00:00.000Z","2020-04-29T00:00:00.000Z","2020-04-30T00:00:00.000Z","2020-05-01T00:00:00.000Z","2020-05-02T00:00:00.000Z","2020-05-03T00:00:00.000Z","2020-05-04T00:00:00.000Z","2020-05-05T00:00:00.000Z","2020-05-06T00:00:00.000Z","2020-05-07T00:00:00.000Z","2020-05-08T00:00:00.000Z","2020-05-09T00:00:00.000Z","2020-05-10T00:00:00.000Z","2020-05-11T00:00:00.000Z","2020-05-12T00:00:00.000Z","2020-05-13T00:00:00.000Z","2020-05-14T00:00:00.000Z","2020-05-15T00:00:00.000Z","2020-05-16T00:00:00.000Z","2020-05-17T00:00:00.000Z","2020-05-18T00:00:00.000Z","2020-05-19T00:00:00.000Z","2020-05-20T00:00:00.000Z","2020-05-21T00:00:00.000Z","2020-05-22T00:00:00.000Z","2020-05-23T00:00:00.000Z","2020-05-24T00:00:00.000Z","2020-05-25T00:00:00.000Z","2020-05-26T00:00:00.000Z","2020-05-27T00:00:00.000Z","2020-05-28T00:00:00.000Z","2020-05-29T00:00:00.000Z","2020-05-30T00:00:00.000Z","2020-05-31T00:00:00.000Z","2020-06-01T00:00:00.000Z","2020-06-02T00:00:00.000Z","2020-06-03T00:00:00.000Z","2020-06-04T00:00:00.000Z","2020-06-05T00:00:00.000Z","2020-06-06T00:00:00.000Z","2020-06-07T00:00:00.000Z","2020-06-08T00:00:00.000Z","2020-06-09T00:00:00.000Z","2020-06-10T00:00:00.000Z","2020-06-11T00:00:00.000Z","2020-06-12T00:00:00.000Z","2020-06-13T00:00:00.000Z","2020-06-14T00:00:00.000Z","2020-06-15T00:00:00.000Z","2020-06-16T00:00:00.000Z","2020-06-17T00:00:00.000Z","2020-06-18T00:00:00.000Z","2020-06-19T00:00:00.000Z","2020-06-20T00:00:00.000Z","2020-06-21T00:00:00.000Z","2020-06-22T00:00:00.000Z","2020-06-23T00:00:00.000Z","2020-06-24T00:00:00.000Z","2020-06-25T00:00:00.000Z","2020-06-26T00:00:00.000Z","2020-06-27T00:00:00.000Z","2020-06-28T00:00:00.000Z","2020-06-29T00:00:00.000Z","2020-06-30T00:00:00.000Z","2020-07-01T00:00:00.000Z","2020-07-02T00:00:00.000Z","2020-07-03T00:00:00.000Z","2020-07-04T00:00:00.000Z","2020-07-05T00:00:00.000Z","2020-07-06T00:00:00.000Z","2020-07-07T00:00:00.000Z","2020-07-08T00:00:00.000Z","2020-07-09T00:00:00.000Z","2020-07-10T00:00:00.000Z","2020-07-11T00:00:00.000Z","2020-07-12T00:00:00.000Z","2020-07-13T00:00:00.000Z","2020-07-14T00:00:00.000Z","2020-07-15T00:00:00.000Z","2020-07-16T00:00:00.000Z","2020-07-17T00:00:00.000Z","2020-07-18T00:00:00.000Z","2020-07-19T00:00:00.000Z","2020-07-20T00:00:00.000Z","2020-07-21T00:00:00.000Z","2020-07-22T00:00:00.000Z","2020-07-23T00:00:00.000Z","2020-07-24T00:00:00.000Z","2020-07-25T00:00:00.000Z","2020-07-26T00:00:00.000Z","2020-07-27T00:00:00.000Z","2020-07-28T00:00:00.000Z","2020-07-29T00:00:00.000Z","2020-07-30T00:00:00.000Z","2020-07-31T00:00:00.000Z","2020-08-01T00:00:00.000Z","2020-08-02T00:00:00.000Z","2020-08-03T00:00:00.000Z","2020-08-04T00:00:00.000Z","2020-08-05T00:00:00.000Z","2020-08-06T00:00:00.000Z","2020-08-07T00:00:00.000Z","2020-08-08T00:00:00.000Z","2020-08-09T00:00:00.000Z","2020-08-10T00:00:00.000Z","2020-08-11T00:00:00.000Z","2020-08-12T00:00:00.000Z","2020-08-13T00:00:00.000Z","2020-08-14T00:00:00.000Z","2020-08-15T00:00:00.000Z","2020-08-16T00:00:00.000Z","2020-08-17T00:00:00.000Z","2020-08-18T00:00:00.000Z","2020-08-19T00:00:00.000Z","2020-08-20T00:00:00.000Z","2020-08-21T00:00:00.000Z","2020-08-22T00:00:00.000Z","2020-08-23T00:00:00.000Z","2020-08-24T00:00:00.000Z","2020-08-25T00:00:00.000Z","2020-08-26T00:00:00.000Z","2020-08-27T00:00:00.000Z","2020-08-28T00:00:00.000Z","2020-08-29T00:00:00.000Z","2020-08-30T00:00:00.000Z","2020-08-31T00:00:00.000Z","2020-09-01T00:00:00.000Z","2020-09-02T00:00:00.000Z","2020-09-03T00:00:00.000Z","2020-09-04T00:00:00.000Z","2020-09-05T00:00:00.000Z","2020-09-06T00:00:00.000Z","2020-09-07T00:00:00.000Z","2020-09-08T00:00:00.000Z","2020-09-09T00:00:00.000Z","2020-09-10T00:00:00.000Z","2020-09-11T00:00:00.000Z","2020-09-12T00:00:00.000Z","2020-09-13T00:00:00.000Z","2020-09-14T00:00:00.000Z","2020-09-15T00:00:00.000Z","2020-09-16T00:00:00.000Z","2020-09-17T00:00:00.000Z","2020-09-18T00:00:00.000Z","2020-09-19T00:00:00.000Z","2020-09-20T00:00:00.000Z","2020-09-21T00:00:00.000Z","2020-09-22T00:00:00.000Z","2020-09-23T00:00:00.000Z","2020-09-24T00:00:00.000Z","2020-09-25T00:00:00.000Z","2020-09-26T00:00:00.000Z","2020-09-27T00:00:00.000Z","2020-09-28T00:00:00.000Z","2020-09-29T00:00:00.000Z","2020-09-30T00:00:00.000Z","2020-10-01T00:00:00.000Z","2020-10-02T00:00:00.000Z","2020-10-03T00:00:00.000Z","2020-10-04T00:00:00.000Z","2020-10-05T00:00:00.000Z","2020-10-06T00:00:00.000Z","2020-10-07T00:00:00.000Z","2020-10-08T00:00:00.000Z","2020-10-09T00:00:00.000Z","2020-10-10T00:00:00.000Z","2020-10-11T00:00:00.000Z","2020-10-12T00:00:00.000Z","2020-10-13T00:00:00.000Z","2020-10-14T00:00:00.000Z","2020-10-15T00:00:00.000Z","2020-10-16T00:00:00.000Z","2020-10-17T00:00:00.000Z","2020-10-18T00:00:00.000Z","2020-10-19T00:00:00.000Z","2020-10-20T00:00:00.000Z","2020-10-21T00:00:00.000Z","2020-10-22T00:00:00.000Z","2020-10-23T00:00:00.000Z","2020-10-24T00:00:00.000Z","2020-10-25T00:00:00.000Z","2020-10-26T00:00:00.000Z","2020-10-27T00:00:00.000Z","2020-10-28T00:00:00.000Z","2020-10-29T00:00:00.000Z","2020-10-30T00:00:00.000Z","2020-10-31T00:00:00.000Z","2020-11-01T00:00:00.000Z","2020-11-02T00:00:00.000Z","2020-11-03T00:00:00.000Z","2020-11-04T00:00:00.000Z","2020-11-05T00:00:00.000Z","2020-11-06T00:00:00.000Z","2020-11-07T00:00:00.000Z","2020-11-08T00:00:00.000Z","2020-11-09T00:00:00.000Z","2020-11-10T00:00:00.000Z","2020-11-11T00:00:00.000Z","2020-11-12T00:00:00.000Z","2020-11-13T00:00:00.000Z","2020-11-14T00:00:00.000Z","2020-11-15T00:00:00.000Z","2020-11-16T00:00:00.000Z","2020-11-17T00:00:00.000Z","2020-11-18T00:00:00.000Z","2020-11-19T00:00:00.000Z","2020-11-20T00:00:00.000Z","2020-11-21T00:00:00.000Z","2020-11-22T00:00:00.000Z","2020-11-23T00:00:00.000Z","2020-11-24T00:00:00.000Z","2020-11-25T00:00:00.000Z","2020-11-26T00:00:00.000Z","2020-11-27T00:00:00.000Z","2020-11-28T00:00:00.000Z","2020-11-29T00:00:00.000Z","2020-11-30T00:00:00.000Z","2020-12-01T00:00:00.000Z","2020-12-02T00:00:00.000Z","2020-12-03T00:00:00.000Z","2020-12-04T00:00:00.000Z","2020-12-05T00:00:00.000Z","2020-12-06T00:00:00.000Z","2020-12-07T00:00:00.000Z","2020-12-08T00:00:00.000Z","2020-12-09T00:00:00.000Z","2020-12-10T00:00:00.000Z","2020-12-11T00:00:00.000Z","2020-12-12T00:00:00.000Z","2020-12-13T00:00:00.000Z","2020-12-14T00:00:00.000Z","2020-12-15T00:00:00.000Z","2020-12-16T00:00:00.000Z","2020-12-17T00:00:00.000Z","2020-12-18T00:00:00.000Z","2020-12-19T00:00:00.000Z","2020-12-20T00:00:00.000Z","2020-12-21T00:00:00.000Z","2020-12-22T00:00:00.000Z","2020-12-23T00:00:00.000Z","2020-12-24T00:00:00.000Z","2020-12-25T00:00:00.000Z","2020-12-26T00:00:00.000Z","2020-12-27T00:00:00.000Z","2020-12-28T00:00:00.000Z","2020-12-29T00:00:00.000Z","2020-12-30T00:00:00.000Z","2020-12-31T00:00:00.000Z","2021-01-01T00:00:00.000Z","2021-01-02T00:00:00.000Z","2021-01-03T00:00:00.000Z","2021-01-04T00:00:00.000Z","2021-01-05T00:00:00.000Z","2021-01-06T00:00:00.000Z","2021-01-07T00:00:00.000Z","2021-01-08T00:00:00.000Z","2021-01-09T00:00:00.000Z","2021-01-10T00:00:00.000Z","2021-01-11T00:00:00.000Z","2021-01-12T00:00:00.000Z","2021-01-13T00:00:00.000Z","2021-01-14T00:00:00.000Z","2021-01-15T00:00:00.000Z","2021-01-16T00:00:00.000Z","2021-01-17T00:00:00.000Z","2021-01-18T00:00:00.000Z","2021-01-19T00:00:00.000Z","2021-01-20T00:00:00.000Z","2021-01-21T00:00:00.000Z","2021-01-22T00:00:00.000Z","2021-01-23T00:00:00.000Z","2021-01-24T00:00:00.000Z","2021-01-25T00:00:00.000Z","2021-01-26T00:00:00.000Z","2021-01-27T00:00:00.000Z","2021-01-28T00:00:00.000Z","2021-01-29T00:00:00.000Z","2021-01-30T00:00:00.000Z","2021-01-31T00:00:00.000Z","2021-02-01T00:00:00.000Z","2021-02-02T00:00:00.000Z","2021-02-03T00:00:00.000Z","2021-02-04T00:00:00.000Z","2021-02-05T00:00:00.000Z","2021-02-06T00:00:00.000Z","2021-02-07T00:00:00.000Z","2021-02-08T00:00:00.000Z","2021-02-09T00:00:00.000Z","2021-02-10T00:00:00.000Z","2021-02-11T00:00:00.000Z","2021-02-12T00:00:00.000Z","2021-02-13T00:00:00.000Z","2021-02-14T00:00:00.000Z","2021-02-15T00:00:00.000Z","2021-02-16T00:00:00.000Z","2021-02-17T00:00:00.000Z","2021-02-18T00:00:00.000Z","2021-02-19T00:00:00.000Z","2021-02-20T00:00:00.000Z","2021-02-21T00:00:00.000Z","2021-02-22T00:00:00.000Z","2021-02-23T00:00:00.000Z","2021-02-24T00:00:00.000Z","2021-02-25T00:00:00.000Z","2021-02-26T00:00:00.000Z","2021-02-27T00:00:00.000Z","2021-02-28T00:00:00.000Z","2021-03-01T00:00:00.000Z","2021-03-02T00:00:00.000Z","2021-03-03T00:00:00.000Z","2021-03-04T00:00:00.000Z","2021-03-05T00:00:00.000Z","2021-03-06T00:00:00.000Z","2021-03-07T00:00:00.000Z","2021-03-08T00:00:00.000Z","2021-03-09T00:00:00.000Z","2021-03-10T00:00:00.000Z","2021-03-11T00:00:00.000Z","2021-03-12T00:00:00.000Z","2021-03-13T00:00:00.000Z","2021-03-14T00:00:00.000Z","2021-03-15T00:00:00.000Z","2021-03-16T00:00:00.000Z","2021-03-17T00:00:00.000Z","2021-03-18T00:00:00.000Z","2021-03-19T00:00:00.000Z","2021-03-20T00:00:00.000Z","2021-03-21T00:00:00.000Z","2021-03-22T00:00:00.000Z","2021-03-23T00:00:00.000Z","2021-03-24T00:00:00.000Z","2021-03-25T00:00:00.000Z","2021-03-26T00:00:00.000Z","2021-03-27T00:00:00.000Z","2021-03-28T00:00:00.000Z","2021-03-29T00:00:00.000Z","2021-03-30T00:00:00.000Z","2021-03-31T00:00:00.000Z","2021-04-01T00:00:00.000Z","2021-04-02T00:00:00.000Z","2021-04-03T00:00:00.000Z","2021-04-04T00:00:00.000Z","2021-04-05T00:00:00.000Z","2021-04-06T00:00:00.000Z","2021-04-07T00:00:00.000Z","2021-04-08T00:00:00.000Z","2021-04-09T00:00:00.000Z","2021-04-10T00:00:00.000Z","2021-04-11T00:00:00.000Z","2021-04-12T00:00:00.000Z","2021-04-13T00:00:00.000Z","2021-04-14T00:00:00.000Z","2021-04-15T00:00:00.000Z","2021-04-16T00:00:00.000Z","2021-04-17T00:00:00.000Z","2021-04-18T00:00:00.000Z","2021-04-19T00:00:00.000Z","2021-04-20T00:00:00.000Z","2021-04-21T00:00:00.000Z","2021-04-22T00:00:00.000Z","2021-04-23T00:00:00.000Z","2021-04-24T00:00:00.000Z","2021-04-25T00:00:00.000Z","2021-04-26T00:00:00.000Z","2021-04-27T00:00:00.000Z","2021-04-28T00:00:00.000Z","2021-04-29T00:00:00.000Z","2021-04-30T00:00:00.000Z","2021-05-01T00:00:00.000Z","2021-05-02T00:00:00.000Z","2021-05-03T00:00:00.000Z","2021-05-04T00:00:00.000Z","2021-05-05T00:00:00.000Z","2021-05-06T00:00:00.000Z","2021-05-07T00:00:00.000Z","2021-05-08T00:00:00.000Z","2021-05-09T00:00:00.000Z","2021-05-10T00:00:00.000Z","2021-05-11T00:00:00.000Z","2021-05-12T00:00:00.000Z","2021-05-13T00:00:00.000Z","2021-05-14T00:00:00.000Z","2021-05-15T00:00:00.000Z","2021-05-16T00:00:00.000Z","2021-05-17T00:00:00.000Z","2021-05-18T00:00:00.000Z","2021-05-19T00:00:00.000Z","2021-05-20T00:00:00.000Z","2021-05-21T00:00:00.000Z","2021-05-22T00:00:00.000Z","2021-05-23T00:00:00.000Z","2021-05-24T00:00:00.000Z","2021-05-25T00:00:00.000Z","2021-05-26T00:00:00.000Z","2021-05-27T00:00:00.000Z","2021-05-28T00:00:00.000Z","2021-05-29T00:00:00.000Z","2021-05-30T00:00:00.000Z","2021-05-31T00:00:00.000Z","2021-06-01T00:00:00.000Z","2021-06-02T00:00:00.000Z","2021-06-03T00:00:00.000Z","2021-06-04T00:00:00.000Z","2021-06-05T00:00:00.000Z","2021-06-06T00:00:00.000Z","2021-06-07T00:00:00.000Z","2021-06-08T00:00:00.000Z","2021-06-09T00:00:00.000Z","2021-06-10T00:00:00.000Z","2021-06-11T00:00:00.000Z","2021-06-12T00:00:00.000Z","2021-06-13T00:00:00.000Z","2021-06-14T00:00:00.000Z","2021-06-15T00:00:00.000Z","2021-06-16T00:00:00.000Z","2021-06-17T00:00:00.000Z","2021-06-18T00:00:00.000Z","2021-06-19T00:00:00.000Z","2021-06-20T00:00:00.000Z","2021-06-21T00:00:00.000Z","2021-06-22T00:00:00.000Z","2021-06-23T00:00:00.000Z","2021-06-24T00:00:00.000Z","2021-06-25T00:00:00.000Z","2021-06-26T00:00:00.000Z","2021-06-27T00:00:00.000Z","2021-06-28T00:00:00.000Z","2021-06-29T00:00:00.000Z","2021-06-30T00:00:00.000Z","2021-07-01T00:00:00.000Z","2021-07-02T00:00:00.000Z","2021-07-03T00:00:00.000Z","2021-07-04T00:00:00.000Z","2021-07-05T00:00:00.000Z","2021-07-06T00:00:00.000Z","2021-07-07T00:00:00.000Z","2021-07-08T00:00:00.000Z","2021-07-09T00:00:00.000Z","2021-07-10T00:00:00.000Z","2021-07-11T00:00:00.000Z","2021-07-12T00:00:00.000Z","2021-07-13T00:00:00.000Z","2021-07-14T00:00:00.000Z","2021-07-15T00:00:00.000Z","2021-07-16T00:00:00.000Z","2021-07-17T00:00:00.000Z","2021-07-18T00:00:00.000Z","2021-07-19T00:00:00.000Z","2021-07-20T00:00:00.000Z","2021-07-21T00:00:00.000Z","2021-07-22T00:00:00.000Z","2021-07-23T00:00:00.000Z","2021-07-24T00:00:00.000Z","2021-07-25T00:00:00.000Z","2021-07-26T00:00:00.000Z","2021-07-27T00:00:00.000Z","2021-07-28T00:00:00.000Z","2021-07-29T00:00:00.000Z","2021-07-30T00:00:00.000Z","2021-07-31T00:00:00.000Z","2021-08-01T00:00:00.000Z","2021-08-02T00:00:00.000Z","2021-08-03T00:00:00.000Z","2021-08-04T00:00:00.000Z","2021-08-05T00:00:00.000Z","2021-08-06T00:00:00.000Z","2021-08-07T00:00:00.000Z","2021-08-08T00:00:00.000Z","2021-08-09T00:00:00.000Z","2021-08-10T00:00:00.000Z","2021-08-11T00:00:00.000Z","2021-08-12T00:00:00.000Z","2021-08-13T00:00:00.000Z","2021-08-14T00:00:00.000Z","2021-08-15T00:00:00.000Z","2021-08-16T00:00:00.000Z","2021-08-17T00:00:00.000Z","2021-08-18T00:00:00.000Z","2021-08-19T00:00:00.000Z","2021-08-20T00:00:00.000Z","2021-08-21T00:00:00.000Z","2021-08-22T00:00:00.000Z","2021-08-23T00:00:00.000Z","2021-08-24T00:00:00.000Z","2021-08-25T00:00:00.000Z","2021-08-26T00:00:00.000Z","2021-08-27T00:00:00.000Z","2021-08-28T00:00:00.000Z","2021-08-29T00:00:00.000Z","2021-08-30T00:00:00.000Z","2021-08-31T00:00:00.000Z","2021-09-01T00:00:00.000Z","2021-09-02T00:00:00.000Z","2021-09-03T00:00:00.000Z","2021-09-04T00:00:00.000Z","2021-09-05T00:00:00.000Z","2021-09-06T00:00:00.000Z","2021-09-07T00:00:00.000Z","2021-09-08T00:00:00.000Z","2021-09-09T00:00:00.000Z","2021-09-10T00:00:00.000Z","2021-09-11T00:00:00.000Z","2021-09-12T00:00:00.000Z","2021-09-13T00:00:00.000Z","2021-09-14T00:00:00.000Z","2021-09-15T00:00:00.000Z","2021-09-16T00:00:00.000Z","2021-09-17T00:00:00.000Z","2021-09-18T00:00:00.000Z","2021-09-19T00:00:00.000Z","2021-09-20T00:00:00.000Z","2021-09-21T00:00:00.000Z","2021-09-22T00:00:00.000Z","2021-09-23T00:00:00.000Z","2021-09-24T00:00:00.000Z","2021-09-25T00:00:00.000Z","2021-09-26T00:00:00.000Z","2021-09-27T00:00:00.000Z","2021-09-28T00:00:00.000Z","2021-09-29T00:00:00.000Z","2021-09-30T00:00:00.000Z","2021-10-01T00:00:00.000Z","2021-10-02T00:00:00.000Z","2021-10-03T00:00:00.000Z","2021-10-04T00:00:00.000Z","2021-10-05T00:00:00.000Z","2021-10-06T00:00:00.000Z","2021-10-07T00:00:00.000Z","2021-10-08T00:00:00.000Z","2021-10-09T00:00:00.000Z","2021-10-10T00:00:00.000Z","2021-10-11T00:00:00.000Z","2021-10-12T00:00:00.000Z","2021-10-13T00:00:00.000Z","2021-10-14T00:00:00.000Z","2021-10-15T00:00:00.000Z","2021-10-16T00:00:00.000Z","2021-10-17T00:00:00.000Z","2021-10-18T00:00:00.000Z","2021-10-19T00:00:00.000Z","2021-10-20T00:00:00.000Z","2021-10-21T00:00:00.000Z","2021-10-22T00:00:00.000Z","2021-10-23T00:00:00.000Z","2021-10-24T00:00:00.000Z","2021-10-25T00:00:00.000Z","2021-10-26T00:00:00.000Z","2021-10-27T00:00:00.000Z","2021-10-28T00:00:00.000Z","2021-10-29T00:00:00.000Z","2021-10-30T00:00:00.000Z","2021-10-31T00:00:00.000Z","2021-11-01T00:00:00.000Z","2021-11-02T00:00:00.000Z","2021-11-03T00:00:00.000Z","2021-11-04T00:00:00.000Z","2021-11-05T00:00:00.000Z","2021-11-06T00:00:00.000Z","2021-11-07T00:00:00.000Z","2021-11-08T00:00:00.000Z","2021-11-09T00:00:00.000Z","2021-11-10T00:00:00.000Z","2021-11-11T00:00:00.000Z","2021-11-12T00:00:00.000Z","2021-11-13T00:00:00.000Z","2021-11-14T00:00:00.000Z","2021-11-15T00:00:00.000Z","2021-11-16T00:00:00.000Z","2021-11-17T00:00:00.000Z","2021-11-18T00:00:00.000Z","2021-11-19T00:00:00.000Z","2021-11-20T00:00:00.000Z","2021-11-21T00:00:00.000Z","2021-11-22T00:00:00.000Z","2021-11-23T00:00:00.000Z","2021-11-24T00:00:00.000Z","2021-11-25T00:00:00.000Z","2021-11-26T00:00:00.000Z","2021-11-27T00:00:00.000Z","2021-11-28T00:00:00.000Z","2021-11-29T00:00:00.000Z","2021-11-30T00:00:00.000Z","2021-12-01T00:00:00.000Z","2021-12-02T00:00:00.000Z","2021-12-03T00:00:00.000Z","2021-12-04T00:00:00.000Z","2021-12-05T00:00:00.000Z","2021-12-06T00:00:00.000Z","2021-12-07T00:00:00.000Z"],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.0311890838206628,0.0339805825242718,0.0406779661016949,0.0557868442964196,0.0545335085413929,0.0660643704121965,0.0725609756097561,0.0838548185231539,0.0778995960761685,0.0507772020725389,0.0456698240866035,0.0474686246051396,0.0517983399938518,0.0486385366867595,0.0332392714479422,0.0351560536764336,0.048508425460969,0.0667591354171827,0.0736976024342899,0.0859868829095132,0.115585434476788,0.130889198378941,0.0998058029521778,0.127595016173893,0.131530890181998,0.127615078166997,0.173070761343751,0.168018434852031,0.173897195807481,0.172270532080167,0.175890063811583,0.183710435212661,0.190922356193841,0.237587236260501,0.184786293958521,0.216099088519823,0.168608205595634,0.189098602263003,0.19941610202123,0.194559562905054,0.150721772929001,0.243356405106871,0.225703324808184,0.164230073466977,0.174309477239882,0.171603671676953,0.158724321710308,0.169795752415574,0.18859384654324,0.170800289291236,0.115347752179102,0.122264205352637,0.144815315025618,0.141620925714638,0.156718423341972,0.155831060129165,0.102724772714189,0.0913920690473366,0.0900884091109558,0.094114765635415,0.100895196117451,0.109836627612319,0.121267228621664,0.0875384639913267,0.0742054114959077,0.0681371417767484,0.0785357351659625,0.0685026201360241,0.0741063020752625,0.081627159501808,0.0550838715324451,0.0528590086684034,0.0469562282234801,0.0598904015868891,0.058894039214806,0.0646816630943528,0.0624642737468709,0.0618382917480005,0.0483519269776876,0.0498363630472117,0.0559870676901119,0.0483596647193294,0.0570940688113265,0.0578075218174262,0.0580346019920149,0.040952021811026,0.0338723930238484,0.0419781494334106,0.0448933535964243,0.0515587503553382,0.0552676196674943,0.049877680438437,0.0398413321963418,0.034329832275573,0.0349561350313321,0.0501071642999763,0.04848834630103,0.0459012836381748,0.0405261927815432,0.0335530952529641,0.0363374427357712,0.0377320442662807,0.0413411173274953,0.047648603305723,0.046307951508579,0.0397173566250217,0.0369763906822764,0.0363403799627176,0.0399711103703514,0.0437807385195534,0.0548234351568438,0.0626056124095768,0.0555913399691626,0.050043820458873,0.0482239822691568,0.0533658750290011,0.0562033829676394,0.0609863880354277,0.0697697006514641,0.0593944461320525,0.0565167930407808,0.0564847550500027,0.0646987309224975,0.0713403940610002,0.0805743942741038,0.084952027447587,0.0652031915333416,0.0598570973225669,0.0606149890453611,0.0591795554888003,0.067147404037879,0.0722722782294059,0.0828314439940217,0.0709325836871302,0.0653481876392093,0.0660136969099848,0.0735527921820458,0.0677237956187652,0.0684509293065029,0.0867060875957735,0.0659918501916241,0.0629840043380683,0.0628398165418683,0.0645821340536392,0.0684105582543468,0.0757197950294994,0.0800100940487909,0.074184430056847,0.0651840284878041,0.0641789036672561,0.0664055953754553,0.0697412664427694,0.0716902488747149,0.0813599610451185,0.0611089805131795,0.0605820967793028,0.0556354116397032,0.0580621648988097,0.0602156487628897,0.0677327670135049,0.0773751193026025,0.0600973573877339,0.0586804944571529,0.0527831803329703,0.0551557872205405,0.0618602914486418,0.0660993281037102,0.0735820819938078,0.0554395731848759,0.0482849586540566,0.0428032640063688,0.046191408994023,0.0507836776294529,0.0566881747505587,0.0575548660767529,0.0605961531251172,0.0432530706997785,0.0445232799408963,0.0446902195319343,0.0471655016424461,0.0558751654936502,0.0543782909772932,0.0551427193988662,0.0485247266910783,0.0315808634218183,0.0449230304479716,0.0521238823843667,0.0517479776856518,0.0530213584270696,0.0606805890111374,0.0435813766486822,0.0347511682072476,0.0349826332241725,0.0432218236271185,0.0451670432127,0.053104011747449,0.0520624122283932,0.0405321884508533,0.0344578254047926,0.0391270632164156,0.0397637292516819,0.0445489328649468,0.0582455522000689,0.0732419896571947,0.036308145857933,0.0344824152048288,0.0375936222907127,0.0483132282700676,0.045468583599574,0.0624265653505615,0.0559360986966709,0.0443802336977773,0.0350207836501952,0.0379091105838924,0.0449539637180066,0.0489449168646324,0.0546918504260639,0.0773039903588313,0.0349157938125518,0.0375312630742123,0.0393910050847387,0.042087996333843,0.0467832867143002,0.0598831300813008,0.0593224422323998,0.0510660470356288,0.0486704722872756,0.0501068795465976,0.0529826023011461,0.0472465694052919,0.0621291448516579,0.0747300684606908,0.0474198243884115,0.0434058126232755,0.0490166335561362,0.0581941706902563,0.06660569402016,0.0752368989017164,0.0781759298827749,0.0555034083854639,0.0544472719510971,0.0610188449160721,0.0665051563005691,0.0690117793806339,0.0824796705037491,0.092465706265037,0.0677251158785702,0.066212052801536,0.0715497382384174,0.0791877742847655,0.086512640170592,0.102284393996641,0.106582511183283,0.0908266689197313,0.0797701105787322,0.0882929116304766,0.0953104642693412,0.0995118672999898,0.11293507899591,0.111632461298629,0.0848437541829764,0.0820871520837453,0.0903224687666186,0.0924958277594929,0.0926267824808977,0.0990048463812468,0.107367350159237,0.0902222914365979,0.0811836749739937,0.0683948325025865,0.136182839449814,0.112330307845939,0.118227756189669,0.114466307956684,0.0999672795288686,0.0959049283973877,0.101420241102358,0.109269962472809,0.121639952646823,0.133019767928588,0.132803607176692,0.114764801992403,0.103454088469641,0.103237691692764,0.136419828736612,0.120528641320256,0.147530874578856,0.134470988847245,0.104462109069892,0.117900958706469,0.115826166951958,0.1242542961446,0.113330648691646,0.140981165785752,0.131846231955363,0.101473817916102,0.0999640106212557,0.102308552455927,0.0936702446557539,0.218590487940586,0.16082093339988,0.146433109175989,0.107771006313045,0.104630879200277,0.120098751466638,0.117313846886819,0.260892982076301,0.192087641771494,0.1789046909644,0.119179190194502,0.109544286592224,0.124059488227063,0.139866679377155,0.146587344397254,0.178159803685935,0.147964020414061,0.112944320738946,0.108318348488219,0.114661871894959,0.11707650659984,0.126641955389422,0.15801119958977,0.108956676880414,0.102949930969842,0.0865993435765275,0.0921894820494231,0.0989136614087239,0.108050734303825,0.12865703627272,0.126139436861402,0.0840118300756752,0.0750408757675347,0.0866391868246914,0.088890796860918,0.0932356101497205,0.120228041834435,0.136757591591742,0.070326119255906,0.0640426770002046,0.0648376941735047,0.0704673773931516,0.0785050182560242,0.105045951059354,0.0886316062393478,0.0566964314599022,0.0576891304506282,0.0742152565603997,0.0702540094224866,0.0766326949991219,0.0958211578765503,0.0689545904230567,0.0514490471881988,0.047556913616565,0.0506057235340475,0.0574371509665259,0.0657233003805579,0.0805260607900252,0.0569880457928359,0.0435619345998539,0.043799817466324,0.0481644496750426,0.0528352445446487,0.0581520392740134,0.080160936011401,0.056803699814849,0.0356598690376401,0.0382105976873559,0.0431724936250598,0.0457579436472762,0.0529418589202611,0.0655100806121948,0.0963437234326675,0.0361876092445135,0.0359203339520145,0.0414920566724018,0.0457510934030754,0.0482407980655788,0.0654493017293956,0.0599956129441238,0.0362646680344086,0.0363410213670233,0.0409006945745536,0.0450046360944264,0.0549213794272636,0.0556010862318487,0.0559295024138738,0.0369844621721675,0.0480868298789148,0.0476512214089914,0.0541142254043912,0.060694476802611,0.0713241962308651,0.0699736284519921,0.0405350570209462,0.0428993699849648,0.053395929367104,0.0509347959756543,0.0660253823410721,0.0651968760457297,0.0805864120245187,0.0398727612910199,0.0438137176679761,0.0530089556132846,0.056182545410471,0.0640244083293622,0.0743651903266507,0.0681269078176602,0.0479415829570249,0.0452377354974986,0.0496574904012409,0.0538508431848656,0.0534410208490807,0.067562517237834,0.0689265470213254,0.0388741876260525,0.0377904884917244,0.0442688597599199,0.0452288601311824,0.0507518551257181,0.0569174983479336,0.0474182664759317,0.0329607142494078,0.0347124247405655,0.0405638446257238,0.0445054071670156,0.0494960162336406,0.0567083801405844,0.0557110396962352,0.0287965496171827,0.029230435368049,0.0364225640587019,0.0403521948881952,0.0394853510356313,0.0460576256642133,0.0425415296890001,0.0254822699813605,0.0263966618633962,0.0321837367429111,0.0377771570847956,0.036882144725282,0.0368145195936523,0.0366209474276816,0.0229491129796783,0.0244147920028286,0.0293770494404891,0.0294771816274379,0.0258120522949136,0.0346224803887505,0.0359996403969119,0.0212704923376679,0.022287706403832,0.0299258728784037,0.0262925729211808,0.0199609414795616,0.0206729113192662,0.017404257607049,0.0318779007194773,0.015195313591504,0.0197005308853452,-0.0276130196210185,0.0169507749366049,0.016690854344966,0.0302113959025445,0.0160230705105469,0.0238457641572685,0.0201462352209085,0.022041284674057,0.0148614736176981,0.0196527540495619,0.0253463135606717,0.0143002719846205,0.0182783983602586,0.0168877815438595,0.0184055570289663,0.0153240283999935,0.0122497218713161,0.0279681765786821,0.0163887897133728,0.0184405141947668,0.0212918247796561,0.0223550574152815,0.0138475121989017,0.0121384742410112,0.0283816370005422,0.0226799515515054,0.023705169824982,0.101263316736453,0.0341297954316577,0.00895442058642148,0.0112444297357828,0.0149854421537779,0.0458816332824422,0.0388939442106984,0.0681640711532497,0.0532175254114249,0.0159626345136931,0.0162354684795248,0.0603361691315773,0.0582835229923088,0.0502004456105775,0.0469639301682424,0.0721820473694686,0.0236815765136609,0.0227907352517913,0.0900402261427328,0.0690950595213595,0.0645864816781186,0.0716190609483676,0.0944790356227208,0.033070890264077,0.0281886169584089,0.118846745075609,0.103396406128399,0.0770836660037453,0.0889668087386488,0.117266938722447,0.0388735086031428,0.0403887509901366,0.141154738433024,0.119043131167535,0.0851896338356264,0.092386677668199,0.126550107456076,0.0421336230613931,0.0505040180015431,0.158147763649671,0.113366918661539,0.101929811343006,0.0909906115851675,0.123103928063244,0.0442179859633613,0.055265467974331,0.203336214333905,0.0900006736157197,0.0969913479600182,0.0969688434963705,0.12959795973754,0.0676403782156252,0.0484457780542643,0.201958675973893,0.0831239972483304,0.0879335241159243,0.0963520752584932,0.104393721808217,0.0596978243577822,0.0432878118903378,0.195893955716144,0.0821723234384695,0.10379428763702,0.0896587480761458,0.102755825647554,0.0487903604063426,0.044827213833793,0.0935206435254425,0.215333284708904,0.0905979130739317,0.0827186573439596,0.0858515968506084,0.0484848087360016,0.0404052578518964,0.19297484323138,0.0814406465074008,0.0804836538193264,0.0776860946690656,0.0877502929162367,0.049080302227546,0.0418510139098374,0.151556694883726,0.0681230686015942,0.0719774033907602,0.0643629420786879,0.0734253210401033,0.0382987947371078,0.0392298639702891,0.160231938134476,0.0608274660642955,0.0642891732133781,0.0604295260133642,0.0692264803836473,0.0336438131886608,0.0325177570940283,0.136950246625747,0.0538078367942094,0.0640487798924816,0.0557947933964357,0.0635949870079844,0.0303061543394526,0.0320721543428055,0.108153391030299,0.0679838217319618,0.0579503720707889,0.0479731041325166,0.0578992262087991,0.0281546731670629,0.03205960377039,0.101066543431954,0.0491456781190941,0.0463151140875005,0.0448795640965678,0.0544153910981566,0.0271657498772604,0.0272422878296967,0.0922656975189188,0.0524653423753226,0.0530471355534309,0.0515316903303266,0.0577234365362945,0.0282231984692242,0.0312395050780946,0.119595428165458,0.0474016657086901,0.0451855481232159,0.0477863575346893,0.0581901006824186,0.0288912347545118,0.0267459336129233,0.104160283337452,0.0452263251124131,0.0553477434209534,0.0379640757271683,0.0887568848667079,0.0558611083057881,0.0307823293340252,0.120858558957824,0.0498944598594563,0.0594268865387503,0.0595361629023184,0.0733167354297021,0.0365770559674206,0.041885292083557,0.140785270964112,0.0582892048324792,0.0742041399884261,0.0417293334776022,0.0701918099337929,0.0284144813801616,0.0351848859245765,0.200136007216709,0.0773178227011364,0.127478665433566,0.239510960398912,null,null,null,null,null]]},"evals":[],"jsHooks":[]}</script>
</div>
<div id="world-bank-data" class="section level2">
<h2>World Bank data</h2>
<p>Country-level covariates by <a href="https://data.worldbank.org/">World Bank Open Data</a> can be easily added. Refer to the table at the bottom of <a href="https://datatopics.worldbank.org/universal-health-coverage/coronavirus/">this page</a> for relevant indicators. The following code snippet shows e.g., how to download the number of hospital beds for each country. Refer to the <a href="https://covid19datahub.io/articles/r.html">quickstart guide</a> for more details.</p>
<pre class="r"><code>x <- covid19(wb = c("hosp_beds" = "SH.MED.BEDS.ZS"), verbose = FALSE)</code></pre>
</div>
<div id="mobility-data" class="section level2">
<h2>Mobility data</h2>
<p>Mobility data are obtained from <a href="https://www.google.com/covid19/mobility/">Google</a> and <a href="https://www.apple.com/covid19/mobility">Apple</a> mobility reports. The following example shows how to download the data by Google. Refer to the <a href="https://covid19datahub.io/articles/r.html">quickstart guide</a> for Apple’s reports and for more details.</p>
<pre class="r"><code>x <- covid19(gmr = TRUE, verbose = FALSE)
colnames(x[,48:53])</code></pre>
<pre><code>## [1] "retail_and_recreation_percent_change_from_baseline"
## [2] "grocery_and_pharmacy_percent_change_from_baseline"
## [3] "parks_percent_change_from_baseline"
## [4] "transit_stations_percent_change_from_baseline"
## [5] "workplaces_percent_change_from_baseline"
## [6] "residential_percent_change_from_baseline"</code></pre>
</div>
<div id="spatial-data" class="section level2">
<h2>Spatial data</h2>
<p>The dataset contains NUTS codes to match the <a href="https://ec.europa.eu/eurostat/web/nuts/nuts-maps">Eurostat</a> database for Europe, and GID codes to match the <a href="https://gadm.org/">GADM</a> worldwide database. The following example shows how to access spatial data using GADM for U.S. counties. Similar maps are available worldwide for most other countries at the various granularity levels.</p>
<p>First, download level 3 data for U.S.</p>
<pre class="r"><code>x <- covid19("USA", level = 3, verbose = FALSE)</code></pre>
<p>GADM data by country can be found <a href="https://gadm.org/download_country.html">here</a>. Download the geopackage for U.S. using GADM version 3.6:</p>
<pre class="r"><code>url <- "https://biogeo.ucdavis.edu/data/gadm3.6/gpkg/gadm36_USA_gpkg.zip"
zip <- tempfile()
download.file(url, destfile = zip)</code></pre>
<p>Unzip the geopackage:</p>
<pre class="r"><code>exdir <- tempfile()
unzip(zip, exdir = exdir)</code></pre>
<p>Load the <code>sf</code> package and list the layers:</p>
<pre class="r"><code>library(sf)
file <- paste0(exdir, "/gadm36_USA.gpkg")
st_layers(file)</code></pre>
<pre><code>## Driver: GPKG
## Available layers:
## layer_name geometry_type features fields
## 1 gadm36_USA_2 Multi Polygon 3148 13
## 2 gadm36_USA_1 Multi Polygon 51 10
## 3 gadm36_USA_0 Multi Polygon 1 2</code></pre>
<p>Read layer 2 that corresponds to U.S. counties. Note: in general, there is not a perfect correspondence between GADM layers and the granularity <code>level</code> from this package. It is recommended to read all the layers, and match on the corresponding GID. Read more about how <code>key_gadm</code> from this package is mapped to the corresponding GID <a href="https://covid19datahub.io/articles/docs.html#external-keys">here</a>.</p>
<pre class="r"><code>g <- st_read(file, layer = "gadm36_USA_2")</code></pre>
<pre><code>## Reading layer `gadm36_USA_2' from data source
## `/private/var/folders/w0/skxpg0h51jg72m5b01y_8n_c0000gn/T/RtmpmUy7P6/file56232c611dfd/gadm36_USA.gpkg'
## using driver `GPKG'
## Simple feature collection with 3148 features and 13 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -179.2 ymin: 18.91 xmax: 179.8 ymax: 72.69
## Geodetic CRS: WGS 84</code></pre>
<p>Subset the data to extract only the counts as of, e.g., 15 November 2021. Select only the administrative divisions inside the following bounding box for better visualization.</p>
<pre class="r"><code>x <- x[
x$date == "2021-11-15" &
x$latitude > 24.9493 & x$latitude < 49.5904 &
x$longitude > -125.0011 & x$longitude < -66.9326,]</code></pre>
<p>Merge COVID-19 data with the spatial data:</p>
<pre class="r"><code>library(dplyr)
gx <- right_join(g, x, by = c("GID_2" = "key_gadm"))</code></pre>
<p>Plot e.g., the total number of confirmed cases:</p>
<pre class="r"><code>plot(gx["confirmed"], logz = TRUE)</code></pre>
<p><img src="map2.png" /></p>
</div>
<div id="academic-publications" class="section level2">
<h2>Academic publications</h2>
<p>See the <a href="https://scholar.google.com/scholar?oi=bibs&hl=en&cites=1585537563493742217">publications</a> that use COVID-19 Data Hub.</p>
</div>
<div id="cite-as" class="section level2">
<h2>Cite as</h2>
<p><em>Guidotti, E., Ardia, D., (2020), “COVID-19 Data Hub”, Journal of Open Source Software 5(51):2376, doi: 10.21105/joss.02376.</em></p>
<p>A BibTeX entry for LaTeX users is</p>
<pre class="latex"><code>@Article{,
title = {COVID-19 Data Hub},
year = {2020},
doi = {10.21105/joss.02376},
author = {Emanuele Guidotti and David Ardia},
journal = {Journal of Open Source Software},
volume = {5},
number = {51},
pages = {2376}
}</code></pre>
</div>
<script>window.location.href='https://rviews.rstudio.com/2021/12/08/the-r-package-covid19/';</script>
October 2021: "Top 40" New CRAN Packages
https://rviews.rstudio.com/2021/11/29/october-2021-top-40-new-cran-packages/
Mon, 29 Nov 2021 00:00:00 +0000https://rviews.rstudio.com/2021/11/29/october-2021-top-40-new-cran-packages/
<p>One hundred forty-one new packages made it to CRAN in October. Here are my “Top 40” picks in twelve categories: Computational Methods, Data, Genomics, Machine Learning, Medicine, Networks, Science, Social Science, Statistics, Time Series, Utilities, and Visualization.</p>
<h3 id="computational-methods">Computational Methods</h3>
<p><a href="https://cran.r-project.org/package=gslnls">gslnls</a> v1.0.2: Implements an R interface to nonlinear least-squares optimization with the GNU Scientific Library (GSL). See <a href="https://www.amazon.com/GNU-Scientific-Library-Reference-Manual/dp/0954612078">M. Galassi et al. (2009)</a>.</p>
<p><a href="https://cran.r-project.org/package=rsvddpd">rsvddpd</a> v1.0.0: Implements a robust method for computing the singular value decomposition using power density divergence. See <a href="https://arxiv.org/abs/2109.10680">Roy et. al (2021)</a> for background and the <a href="https://cran.r-project.org/web/packages/rsvddpd/vignettes/rSVDdpd-intro.html">vignette</a> for an example.</p>
<h3 id="data">Data</h3>
<p><a href="https://cran.r-project.org/package=blsR">blsR</a> v0.2.1: Implements v2 of the <a href="https://www.bls.gov/developers/api_signature_v2.htm">Bureau of Labor Statistics API</a> for requests of survey information and time series data. See <a href="https://cran.r-project.org/web/packages/blsR/readme/README.html">README</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=insiderTrades">insiderTrades</a> v0.0.1: Provides functions to download insider trading transactions and insider holdings from a public <a href="https://www.sec.gov/Archives/edgar/full-index/">NoSQL SEC database</a> using keyword criteria and generate a relational dataframe. See the vignettes <a href="https://cran.r-project.org/web/packages/insiderTrades/vignettes/insiderTrades.html">insiderTrades</a> and <a href="https://cran.r-project.org/web/packages/insiderTrades/vignettes/pullAndScrape.html">pullAndScrape</a>.</p>
<p><a href="https://cran.r-project.org/package=KingCountyHouses">KingCountyHouses</a> v0.1.0: Contains data on houses in and around Seattle WA are included. Basic characteristics are given along with sale prices. See <a href="https://cran.r-project.org/web/packages/KingCountyHouses/readme/README.html">README</a>.</p>
<p><a href="https://cran.r-project.org/package=meteospain">meteospain</a> v0.0.3: Provides access to different Spanish meteorological stations data services and APIs including AEMET, SMC, MG, and Meteoclimatic. There are seven short vignettes including <a href="https://cran.r-project.org/web/packages/meteospain/vignettes/api_limits.html">API limits and loops</a> and <a href="https://cran.r-project.org/web/packages/meteospain/vignettes/compatibility.html">Compatibility between services</a>.</p>
<p><a href="https://cran.r-project.org/package=owidR">owidR</a> v1.1.0: Provides function to import, search, download, and visualize data from the <a href="https://ourworldindata.org/">Our World in Data</a> website. See the <a href="https://cran.r-project.org/web/packages/owidR/vignettes/example-analysis.html">vignette</a>.</p>
<p><img src="owidR.png" height = "400" width="500" alt="Choropleth Showing Share of Population Using the Internet by Country"></p>
<p><a href="https://cran.r-project.org/package=QBMS">QBMS</a> v0.6: Enables users to query the <a href="https://bmspro.io/">Breeding Management System</a> database. There is a short <a href="https://cran.r-project.org/package=QBMS">Tutorial</a>.</p>
<h3 id="genomics">Genomics</h3>
<p><a href="https://cran.r-project.org/package=digitalDLSorteR">digitalDLSorteR</a> v0.1.1: Implements tools for the deconvolution of bulk RNA-Seq data using context-specific deconvolution models based on Deep Neural Networks using scRNA-Seq data as input. See <a href="https://www.frontiersin.org/articles/10.3389/fgene.2019.00978/full">Torroja & Sanchez-Cabo (2019)</a> for details. There are five vignettes including <a href="https://cran.r-project.org/web/packages/digitalDLSorteR/vignettes/kerasIssues.html">Keras/TensorFlow installation and configuration</a> and <a href="https://cran.r-project.org/web/packages/digitalDLSorteR/vignettes/newModels.html">Building new deconvolution models</a>.</p>
<p><img src="DLRSorteR.png" height = "400" width="600" alt="Process Flow Diagram"></p>
<p><a href="https://cran.r-project.org/package=Platypus">Platypus</a> v3.2.3: Implements an open-source software platform for investigating B-cell receptor and T-cell receptor repertoires from scSeq experiments which also incorporates transcriptional information involving unsupervised clustering, gene expression and gene ontology. See <a href="https://academic.oup.com/nargab/article/3/2/lqab023/6225857">Yermanos et al. (2021)</a> and the <a href="https://cran.r-project.org/web/packages/Platypus/vignettes/PlatypusV3_agedCNS.html">vignette</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=quincunx">quincunx</a> v0.1.4: Provides programmatic access to the <a href="https://www.pgscatalog.org/">PGS Catalog</a> through the <a href="https://www.pgscatalog.org/rest/">REST API</a>. See <a href="https://cran.r-project.org/web/packages/quincunx/readme/README.html">README</a> for the cheatsheet.</p>
<p><img src="quincunx.png" height = "300" width="500" alt="Cheatsheet for API Commands"></p>
<p><a href="https://cran.r-project.org/package=SNPfiltR">SNPfilter</a> v0.1.0: Provides functions to interactively and reproducibly visualize and filter SNP (single-nucleotide polymorphism) datasets, including functions for visualizing various quality and missing data metrics for a SNP dataset, and then filtering the dataset based on user specified cutoffs. See the <a href="https://cran.r-project.org/web/packages/SNPfiltR/vignettes/reproducible-vignette.html">vignette</a>.</p>
<p><img src="SNPfilter.png" height = "400" width="400" alt="Plot of Completeness vs. Missing Data"></p>
<h3 id="machine-learning">Machine Learning</h3>
<p><a href="https://cran.r-project.org/package=conText">conText</a> v1.0.0: Implements a framework to estimate context-specific word and short document embeddings using the <em>a la carte</em> embeddings approach developed by <a href="https://arxiv.org/abs/1805.05388">Khodak et al. (2018)</a> and evaluate hypotheses about covariate effects on embeddings using the regression framework developed by <a href="https://github.com/prodriguezsosa/EmbeddingRegression">Rodriguez et al. (2021)</a>. There is a <a href="https://cran.r-project.org/web/packages/conText/vignettes/quickstart.html">Quick Start Guide</a>.</p>
<p><a href="https://cran.r-project.org/package=pixelclasser">pixelclassifier</a> v1.0.0: Implements a Support Vector Machine to classify the pixels of an image file by its color. See the <a href="https://cran.r-project.org/web/packages/pixelclasser/vignettes/pixelclasser.html">vignette</a>.</p>
<p><img src="pixel.png" height = "300" width="300" alt="Plot Showing Boundaries Separating Pixels"></p>
<p><a href="https://cran.r-project.org/package=predtools">predtools</a> v0.0.2: Provides functions for evaluating predictive models, including plotting calibration curves and model-based Receiver Operating Characteristic (mROC) curves based on <a href="https://arxiv.org/abs/2003.00316">Sadatsafavi et al. (2021)</a>. There are three vignettes: <a href="https://cran.r-project.org/web/packages/predtools/vignettes/calibPlot.html">Calibration Plot</a>, <a href="https://cran.r-project.org/web/packages/predtools/vignettes/interceptAdj.html">Intercept Adjustment</a>, and <a href="https://cran.r-project.org/web/packages/predtools/vignettes/mROC.html">Model-based ROC</a>.</p>
<p><img src="predtools.png" height = "300" width="300" alt="Calibration Plot"></p>
<p><a href="https://cran.r-project.org/package=text2sdg">text2sdg</a> v0.1.1: Provides functions to identify <em>Sustainable Development Goals</em> in text using scientifically developed query systems, opening up the opportunity to monitor any type of text-based data, such as scientific output or corporate publications. There is a <a href="https://cran.r-project.org/web/packages/text2sdg/vignettes/text2sdg.html">vignette</a>.</p>
<p><img src="text2sdg.png" height = "300" width="500" alt="Histogram of SDGs by Query System"></p>
<p><a href="https://cran.r-project.org/package=Twitmo">Twitmo</a> v0.1.1: Provides functions to collect, pre-process and analyze the contents of tweets using LDA and STM models including functions to generate tweet and hashtag maps and built-in support for <code>LDAvis</code>. See <a href="https://cran.r-project.org/web/packages/Twitmo/readme/README.html">README</a> for examples.</p>
<p><img src="Twitmo.png" height = "300" width="500" alt="Plot of Geo-Tagged Tweets"></p>
<h3 id="medicine">Medicine</h3>
<p><a href="https://cran.r-project.org/package=ctrialsgov">ctrialsgov</a> v0.2.5: Provides tools to access and query the U.S. National Library of Medicine’s <a href="https://clinicaltrials.gov/">Clinical Trials database</a> including functions for searching the data using range queries, categorical filtering, and by searching for full-text keywords. There is an <a href="https://cran.r-project.org/web/packages/ctrialsgov/vignettes/introduction.html">Introduction</a> and a vignette on <a href="https://cran.r-project.org/web/packages/ctrialsgov/vignettes/text_analysis.html">Text Analysis</a>.</p>
<p><a href="https://cran.r-project.org/package=epidemia">epidemia</a> v1.0.0: Implements functions to specify and fit Bayesian statistical models for epidemics. Infections are propagated over time using self-exciting point processes. Multiple regions can be modeled simultaneously with multilevel models. See <a href="https://arxiv.org/abs/2012.00394">Bhatt et al. (2021)</a> for background on the models and the <a href="https://imperialcollegelondon.github.io/epidemia/index.html">package website</a> for examples and extensive documentation.</p>
<p><img src="epidemia.png" height = "300" width="300" alt="Distribution Plots for Posterior Prediction Checks"></p>
<h3 id="networks">Networks</h3>
<p><a href="https://cran.r-project.org/package=dissCqN">dissCqN</a> v0.1.0: Provides functions to calculate multiple or pairwise dissimilarity for orders q = 0-N for a set of species assemblages or interaction networks. See <a href="https://onlinelibrary.wiley.com/doi/10.1111/j.1541-0420.2008.01010.x">Chao et al. 2008</a> for background and the <a href="https://cran.r-project.org/web/packages/dissCqN/vignettes/dissCqN.html">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=modnets">modnets</a> v0.9.0: Implements methods for modeling moderator variables in cross-sectional, temporal, and multi-level networks including model selection techniques and a variety of plotting functions. See <a href="https://www.proquest.com/openview/d151ab6b93ad47e3f0d5e59d7b6fd3d3">Swanson (2020)</a> for details and the <a href="https://cran.r-project.org/web/packages/modnets/readme/README.html">README</a> for an example.</p>
<p><img src="modnets.png" height = "300" width="500" alt="Network Plot"></p>
<h3 id="science">Science</h3>
<p><a href="https://cran.r-project.org/package=cmpsR">cmpsR</a> v0.1.0: Implements the Congruent Matching Profile Segments (CMPS) method <a href="https://www.sciencedirect.com/science/article/abs/pii/S0379073819303767?via%3Dihub">Chen et al. (2019)</a> to provide an objective comparison of striated tool marks for fired bullet correlation. See the <a href="https://cran.r-project.org/web/packages/cmpsR/vignettes/cmpsR-vignette.html">vignette</a>.</p>
<p><img src="cmpsR.png" height = "300" width="500" alt="Series of Correlation Plots"></p>
<p><a href="https://cran.r-project.org/package=pvcurveanalysis">pvcurveanalysis</a> v1.0.0: Provides functions to analyze and display pressure volume curves which enable the derivation of the turgor loss point, osmotic potential and apoplastic fraction. See <a href="https://onlinelibrary.wiley.com/doi/10.1111/j.1461-0248.2012.01751.x">Bartlett et al. (2012)</a> for background and the <a href="https://cran.r-project.org/web/packages/pvcurveanalysis/vignettes/pvcurveanalysis.html">vignette</a> for examples.</p>
<p><img src="pvcurve.png" height = "300" width="300" alt="Plot Showing Turgor Loss Point"></p>
<h3 id="social-science">Social Science</h3>
<p><a href="https://cran.r-project.org/package=rcbayes">rcbayes</a> v0.1.0: Provides functions to estimate <em>Rogers-Castro</em> migration age schedules using <code>Stan</code>. See <a href="https://journals.sagepub.com/doi/10.1068/a100475">Rogers and Castro (1978)</a> for background and the vignettes on <a href="https://cran.r-project.org/web/packages/rcbayes/vignettes/convergence_issues.html">Model Convergence</a> and <a href="https://cran.r-project.org/web/packages/rcbayes/vignettes/intro_to_rcbayes.html">Rogers Castro Migration Models</a>.</p>
<p><img src="rcbayes.png" height = "300" width="500" alt="Migration Rate Plot"></p>
<p><a href="https://cran.r-project.org/package=QCAcluster">QCAcluster</a> v0.1.0: Provides functions to allow <a href="https://www.google.com/books/edition/Qualitative_Comparative_Analysis_with_R/-Y_Mzk00CioC?hl=en&gbpv=1&dq=qualitative+comparative+analysis&pg=PP3&printsec=frontcover">Qualitative Comparative Analysis</a> researchers to supplement the analysis of pooled data with a disaggregated perspective focusing on selected partitions of the data. The pooled data can be partitioned along the dimensions of the clustered data (individual cross sections or time series) to perform partition-specific truth table minimizations. There are vignettes that discuss the <a href="https://cran.r-project.org/web/packages/QCAcluster/vignettes/Aggregation-over-partitions.html">Aggregation</a>, <a href="https://cran.r-project.org/web/packages/QCAcluster/vignettes/Diversity-of-partitions.html">Diversity</a>, <a href="https://cran.r-project.org/web/packages/QCAcluster/vignettes/Minimization-of-partitions.html">Miimization</a>, and <a href="https://cran.r-project.org/web/packages/QCAcluster/vignettes/Weight-of-partitions.html">Weight</a> of partitions.</p>
<p><img src="QCAcluster.png" height = "300" width="500" alt="UpSet plot that displays how often a single condition occurs over multiple partition-specific models"></p>
<h3 id="statistics">Statistics</h3>
<p><a href="https://cran.r-project.org/package=bayesPO">bayesPO</a> v0.3.1: Provides functions to create Bayesian point process models of presence only data. See <a href="http://www.pg.im.ufrj.br/teses/Estatistica/Doutorado/043.pdf">Moreira (2020)</a> for background, and the <a href="https://cran.r-project.org/web/packages/bayesPO/vignettes/bayesPO.html">vignette</a> for examples.</p>
<p><img src="bayesPO.png" height = "300" width="500" alt="Scatter Plot of Data on Heat Map of Covariates."></p>
<p><a href="https://cran.r-project.org/package=hierbase">hierbase</a> v0.1.2: Implements the algorithms for hierarchical testing of variable importance described in <a href="https://academic.oup.com/biomet/article-abstract/95/2/265/230264">Meinshausen (2008)</a> which control for family-wise error rate. See the <a href="https://cran.r-project.org/web/packages/hierbase/vignettes/vignette-hierbase.pdf">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=pedmod">pedmod</a> v0.1.0: Provides functions to estimate mixed probit models, commonly called liability threshold models, for pedigree data such as that studied in <a href="https://onlinelibrary.wiley.com/doi/10.1002/sim.1603">Pawitan et al. (2004)</a>. See <a href="https://www.tandfonline.com/doi/abs/10.1198/106186002394">Genz & Bretz (2012)</a> for background. There is an <a href="https://cran.r-project.org/web/packages/pedmod/vignettes/pedmod.html">introduction</a> to pedigree models and a vignette on <a href="https://cran.r-project.org/web/packages/pedmod/vignettes/pedigree_partitioning.html">positioning families</a>.</p>
<p><img src="pedmod.png" height = "300" width="500" alt="Plot of Relationship Network"></p>
<p><a href="https://cran.r-project.org/package=slasso">slasso</a> v1.0.0: Implements the smooth LASSO estimator for the function-on-function linear regression model described in <a href="https://arxiv.org/abs/2007.00529">Centofanti et al. (2020)</a>. See <a href="https://cran.r-project.org/web/packages/slasso/readme/README.html">README</a> for examples.</p>
<p><img src="slasso.png" height = "300" width="600" alt="Contour Plot and 3D Plot of Functional Lasso"></p>
<p><a href="https://cran.r-project.org/package=StanMoMo">StanMoMo</a> v1.0.0: Implements Bayesian mortality models including those developed in <a href="https://www.tandfonline.com/doi/abs/10.1080/01621459.1992.10475265">Lee & Carter (1992)</a> and <a href="https://onlinelibrary.wiley.com/doi/10.1111/j.1539-6975.2006.00195.x">Cairns, Blake & Dowd (2006)</a>. There is a <a href="https://cran.r-project.org/web/packages/StanMoMo/vignettes/StanMoMo.html">vignette</a> introducing the <em>Lee & Carter</em> model and another on <a href="https://cran.r-project.org/web/packages/StanMoMo/vignettes/bma.html">Bayesian Model Averaging</a>.</p>
<p><img src="StanMoMo.png" height = "300" width="500" alt="Forecast Plot"></p>
<h3 id="time-series">Time Series</h3>
<p><a href="https://cran.r-project.org/package=esemifar">esemifar</a> v1.0.1: Implements algorithms that provide non-parametric estimates of trend and its derivatives in equidistant time series with long-memory errors. See <a href="https://ideas.repec.org/p/pdn/ciepap/145.html">Letmathe et al. (2021)</a> for a description of the smoothing methods employed, and <a href="https://cran.r-project.org/web/packages/esemifar/readme/README.html">README</a> for an example.</p>
<p><img src="esemifar.png" height = "300" width="500" alt="Plot of London Air Quality Index with Trend"></p>
<p><a href="https://cran.r-project.org/package=GDPuc">GDPuc</a> v0.5.1: Provides a function to convert GDP time series from one unit to another. All common GDP units are included, i.e. current and constant local currency units, US$ via market exchange rates and international dollars via purchasing power parities. See <a href="https://cran.r-project.org/web/packages/GDPuc/index.html">README</a> for examples.</p>
<h3 id="utilities">Utilities</h3>
<p><a href="https://cran.r-project.org/package=framecleaner">framecleaner</a> v0.2.0: Provides a friendly interface for modifying data frames with a sequence of piped commands built upon the <code>tidyverse</code>. See the <a href="https://cran.r-project.org/web/packages/framecleaner/vignettes/cleanYourFrame.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=presenter">presentr</a> v0.1.1: Implements wrapper functions using packages <code>openxlsx</code>, <code>flextable</code>, and <code>officer</code> to create highly formatted MS office friendly output of data frames. Vignettes include: <a href="https://cran.r-project.org/web/packages/presenter/vignettes/exportToExcel.html">exportToExcel</a>, <a href="https://cran.r-project.org/web/packages/presenter/vignettes/flextableAndPowerpoint.html">flextableAndPowerpoint</a>, and <a href="https://cran.r-project.org/web/packages/presenter/vignettes/formattedFlextable.html">formattedFlextable</a>.</p>
<p><a href="https://cran.r-project.org/package=shinyGovstyle">shinyGovstyle</a> v0.0.7: Implements a collection of <code>shiny</code> application styling tools that are the based on the <a href="https://design-system.service.gov.uk/components/">GOV.UK Design System</a>. See <a href="https://cran.r-project.org/web/packages/shinyGovstyle/readme/README.html">README</a> for an introduction and examples.</p>
<p><a href="https://cran.r-project.org/package=validata">validata</a> v0.1.0: Provides functions for validating the structure and properties of data frames helping users to answer essential questions about a data set such as: <em>What are the unique or missing values?</em> and <em>What columns form a primary key?</em>. See the <a href="https://cran.r-project.org/web/packages/validata/vignettes/PackageIntroduction.html">vignette</a> for an introduction.</p>
<h3 id="visualization">Visualization</h3>
<p><a href="https://cran.r-project.org/package=easylabel">easylabel</a> v0.2.4: Implements interactive labeling of scatter plots, volcano plots and Manhattan plots using a <code>shiny</code> or <code>plotly</code> interface. Users can hover over points to see where specific points are located and click points on/off to easily label them. See the <a href="https://cran.r-project.org/web/packages/easylabel/vignettes/easylabel.html">vignette</a> for examples.</p>
<p><img src="easylabel.png" height = "300" width="500" alt="Bubble Plot with Labels"></p>
<p><a href="https://cran.r-project.org/package=ggokabeito">ggokabeito</a> v0.1.0: Provides discrete scales for the colorblind-friendly <code>Okabe-Ito</code> palette, including color, fill, and edge_colour. See <a href="https://cran.r-project.org/web/packages/ggokabeito/readme/README.html">README</a> for examples.</p>
<p><img src="ggokabeito.png" height = "300" width="500" alt="Color Coded Density Plots "></p>
<p><a href="https://cran.r-project.org/package=metaconfoundr">metaconfoundr</a> v0.1.0: Implements an approach for evaluating bias in meta-analysis studies based on the causal inference framework. See the <a href="https://cran.r-project.org/web/packages/metaconfoundr/vignettes/intro-to-metaconfoundr.html">vignette</a> for examples.</p>
<p><img src="metaconfoundr.png" height = "400" width="600" alt="Heat Map of Confounders"></p>
<p><a href="https://cran.r-project.org/package=scatterPlotMatrix">scatterPlotMatrix</a> v0.1.0: Provides functions which make use of the packages <code>htmlwidgets</code> package and <code>d3.js</code> to create scatter plot matrices. See the <a href="https://cran.r-project.org/web/packages/scatterPlotMatrix/vignettes/introduction-to-scatterplotmatrix.html">vignette</a>.
<img src="SPM.png" height = "300" width="500" alt="Multiple Scatter PLots of Several Variables Arranged in a Matrix"></p>
<script>window.location.href='https://rviews.rstudio.com/2021/11/29/october-2021-top-40-new-cran-packages/';</script>
How to Scrape and Store Strava Data Using R
https://rviews.rstudio.com/2021/11/22/strava-data/
Mon, 22 Nov 2021 00:00:00 +0000https://rviews.rstudio.com/2021/11/22/strava-data/
<script src="/2021/11/22/strava-data/index_files/header-attrs/header-attrs.js"></script>
<p><em>This post by Julian During is the third place winner in the <a href="https://rviews.rstudio.com/2021/08/04/r-views-blog-contest/">Call for Documentation</a> contest. Julian is a data scientist from Germany working in the manufacturing industry. Julian loves working with R (especially the tidyverse ecosystem), sports, black coffee and cycling.</em></p>
<p>I am an avid runner and cyclist. For the past couple of years, I have recorded almost all my activities on some kind of GPS device.</p>
<p>I record my runs with a Garmin device and my bike rides with a Wahoo device, and I synchronize both accounts on Strava. I figured that it would be nice to directly access my data from my Strava account.</p>
<p>In the following text, I will describe the progress to get Strava data into R, process the data, and then create a visualization of activity routes. You can find the original analysis in this <a href="https://github.com/duju211/pin_strava">Github repository</a>.</p>
<p>You will need the following packages:</p>
<pre class="r"><code>library(tarchetypes)
library(conflicted)
library(tidyverse)
library(lubridate)
library(jsonlite)
library(targets)
library(httpuv)
library(httr)
library(pins)
library(httr)
library(fs)
library(readr)
conflict_prefer("filter", "dplyr")</code></pre>
<div id="set-up-targets" class="section level2">
<h2>Set Up Targets</h2>
<p>The whole data pipeline is implemented with the help of the <code>targets</code> package. You can learn more about the package and its functionalities <a href="https://docs.ropensci.org/targets/">here</a>.</p>
<p>In order to reproduce the analysis, perform the following steps:</p>
<ul>
<li>Clone the repository: <a href="https://github.com/duju211/pin_strava" class="uri">https://github.com/duju211/pin_strava</a></li>
<li>Install the packages listed in the ‘libraries.R’ file</li>
<li>Run the target pipeline by executing <code>targets::tar_make()</code> command</li>
<li>Follow the instructions printed in the console</li>
</ul>
<div id="target-plan" class="section level3">
<h3>Target Plan</h3>
<p>The manifest of the target plan looks like this:</p>
<table>
<colgroup>
<col width="4%" />
<col width="88%" />
<col width="4%" />
<col width="2%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">my_app</td>
<td align="left">define_strava_app()</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="even">
<td align="left">my_endpoint</td>
<td align="left">define_strava_endpoint()</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="odd">
<td align="left">act_col_types</td>
<td align="left">list(moving = col_logical(), velocity_smooth = col_number(), grade_smooth = col_number(), distance = col_number(), altitude = col_number(), time = col_integer(), lat = col_number(), lng = col_number(), cadence = col_integer(), watts = col_integer())</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="even">
<td align="left">my_sig</td>
<td align="left">define_strava_sig(my_endpoint, my_app)</td>
<td align="left">NA</td>
<td align="left">always</td>
</tr>
<tr class="odd">
<td align="left">df_act_raw</td>
<td align="left">read_all_activities(my_sig)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="even">
<td align="left">df_act</td>
<td align="left">pre_process_act(df_act_raw, athlete_id)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="odd">
<td align="left">act_ids</td>
<td align="left">pull(distinct(df_act, id))</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="even">
<td align="left">df_meas</td>
<td align="left">read_activity_stream(act_ids, my_sig)</td>
<td align="left">map(act_ids)</td>
<td align="left">never</td>
</tr>
<tr class="odd">
<td align="left">df_meas_all</td>
<td align="left">bind_rows(df_meas)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="even">
<td align="left">df_meas_wide</td>
<td align="left">meas_wide(df_meas_all)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="odd">
<td align="left">df_meas_pro</td>
<td align="left">meas_pro(df_meas_wide)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="even">
<td align="left">gg_meas</td>
<td align="left">vis_meas(df_meas_pro)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="odd">
<td align="left">df_meas_norm</td>
<td align="left">meas_norm(df_meas_pro)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
<tr class="even">
<td align="left">gg_meas_save</td>
<td align="left">save_gg_meas(gg_meas)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<p><br>
We will go through the most important targets in detail.</p>
</div>
</div>
<div id="oauth-dance-from-r" class="section level2">
<h2>OAuth Dance from R</h2>
<p>The Strava API requires an ‘OAuth dance’, described below.
<br>
<br>
<font size="4"><strong>1. Create an OAuth Strava app</strong></font>
<br>
To get access to your Strava data from R, you must first create a Strava API. The steps are documented on the <a href="https://developers.strava.com/docs/getting-started/">Strava Developer site</a>. While creating the app, you’ll have to give it a name. In my case, I named it <code>r_api</code>.</p>
<p>After you have created your personal API, you can find your Client ID and Client Secret variables in the <a href="https://www.strava.com/settings/api">Strava API settings</a>. Save the Client ID as <code>STRAVA_KEY</code> and the Client Secret as <code>STRAVA_SECRET</code> in your R environment.<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a></p>
<pre><code>STRAVA_KEY=<Client ID>
STRAVA_SECRET=<Client Secret>
</code></pre>
<p>Then, you can run the function <code>define_strava_app</code> shown below.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">my_app</td>
<td align="left">define_strava_app()</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<pre class="r"><code>define_strava_app <- function() {
oauth_app(
appname = "r_api",
key = Sys.getenv("STRAVA_KEY"),
secret = Sys.getenv("STRAVA_SECRET")
)
}</code></pre>
<p><br>
<font size="4"><strong>2. Define an endpoint</strong></font></p>
<p>Define an endpoint called <code>my_endpoint</code> using the function <code>define_strava_endpoint</code>.</p>
<p>The <code>authorize</code> parameter describes the authorization url and the <code>access</code> argument exchanges the authenticated token.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">my_endpoint</td>
<td align="left">define_strava_endpoint()</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<pre class="r"><code>define_strava_endpoint <- function() {
oauth_endpoint(request = NULL,
authorize = "https://www.strava.com/oauth/authorize",
access = "https://www.strava.com/oauth/token")
}</code></pre>
<p><br>
<font size="4"><strong>3. The final authentication step</strong></font>
</br>
Before you can execute the following steps, you have to authenticate the API in the web browser.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">my_sig</td>
<td align="left">define_strava_sig(my_endpoint, my_app)</td>
<td align="left">NA</td>
<td align="left">always</td>
</tr>
</tbody>
</table>
<pre class="r"><code>define_strava_sig <- function(endpoint, app) {
oauth2.0_token(
endpoint,
app,
scope = "activity:read_all,activity:read,profile:read_all",
type = NULL,
use_oob = FALSE,
as_header = FALSE,
use_basic_auth = FALSE,
cache = FALSE
)
}</code></pre>
<p>The information in <code>my_sig</code> can now be used to access Strava data. Set the <code>cue_mode</code> of the target to ‘always’ so that the following API calls are always executed with an up-to-date authorization token.</p>
</div>
<div id="access-activities" class="section level2">
<h2>Access Activities</h2>
<p>You are now authenticated and can directly access your Strava data.
<br>
<br>
<font size="4"><strong>1. Load all activities</strong></font>
<br>
Load a table that gives an overview of all the activities from the data. Because the total number of activities is unknown, use a while loop. It will break the execution of the loop if there are no more activities to read.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">df_act_raw</td>
<td align="left">read_all_activities(my_sig)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<pre class="r"><code>read_all_activities <- function(sig) {
activities_url <- parse_url("https://www.strava.com/api/v3/athlete/activities")
act_vec <- vector(mode = "list")
df_act <- tibble::tibble(init = "init")
i <- 1L
while (nrow(df_act) != 0) {
r <- activities_url %>%
modify_url(query = list(
access_token = sig$credentials$access_token[[1]],
page = i
)) %>%
GET()
df_act <- content(r, as = "text") %>%
fromJSON(flatten = TRUE) %>%
as_tibble()
if (nrow(df_act) != 0)
act_vec[[i]] <- df_act
i <- i + 1L
}
df_activities <- act_vec %>%
bind_rows() %>%
mutate(start_date = ymd_hms(start_date))
}</code></pre>
<p>The resulting data frame consists of one row per activity:</p>
<pre class="r"><code>## # A tibble: 605 x 60
## resource_state name distance moving_time elapsed_time total_elevation~ type
## <int> <chr> <dbl> <int> <int> <dbl> <chr>
## 1 2 "Hes~ 31153. 4699 5267 450 Ride
## 2 2 "Bam~ 5888. 2421 2869 102. Run
## 3 2 "Lin~ 33208. 4909 6071 430 Ride
## 4 2 "Mon~ 74154. 10721 12500 641 Ride
## 5 2 "Cha~ 34380 5001 5388 464. Ride
## 6 2 "Mor~ 5518. 2345 2563 49.1 Run
## 7 2 "Bin~ 10022. 3681 6447 131 Run
## 8 2 "Tru~ 47179. 8416 10102 898 Ride
## 9 2 "Sho~ 32580. 5646 6027 329. Ride
## 10 2 "Mit~ 33862. 5293 6958 372 Ride
## # ... with 595 more rows, and 53 more variables: workout_type <int>, id <dbl>,
## # external_id <chr>, upload_id <dbl>, start_date <dttm>,
## # start_date_local <chr>, timezone <chr>, utc_offset <dbl>,
## # start_latlng <list>, end_latlng <list>, location_city <lgl>,
## # location_state <lgl>, location_country <chr>, start_latitude <dbl>,
## # start_longitude <dbl>, achievement_count <int>, kudos_count <int>,
## # comment_count <int>, athlete_count <int>, photo_count <int>, ...</code></pre>
<p><br>
<font size="4"><strong>2. Preprocess activities</strong></font>
<br>
Make sure that all ID columns have a character format and improve the column names.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">df_act</td>
<td align="left">pre_process_act(df_act_raw, athlete_id)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<pre class="r"><code>pre_process_act <- function(df_act_raw, athlete_id) {
df_act <- df_act_raw %>%
mutate(across(contains("id"), as.character),
`athlete.id` = athlete_id)
}</code></pre>
<p><br>
<font size="4"><strong>3. Extract activity IDs</strong></font>
<br>
Use <code>dplyr::pull()</code> to extract all activity IDs.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">act_ids</td>
<td align="left">pull(distinct(df_act, id))</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
</div>
<div id="read-measurements" class="section level2">
<h2>Read Measurements</h2>
<p><font size="4"><strong>1. Read the ‘stream’ data from Strava</strong></font>
<br>
A ‘stream’ is a nested list (JSON format) with all available measurements of the corresponding activity.</p>
<p>To get the <br>available variables and turn the result into a data frame, define a helper function <code>read_activity_stream</code>. This function takes an ID of an activity and an authentication token, which you created earlier.</p>
<p>The target is defined with dynamic branching which maps over all activity IDs. Define the <code>cue mode</code> as <code>never</code> to make sure that every target runs exactly once.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">df_meas</td>
<td align="left">read_activity_stream(act_ids, my_sig)</td>
<td align="left">map(act_ids)</td>
<td align="left">never</td>
</tr>
</tbody>
</table>
<pre class="r"><code>read_activity_stream <- function(id, sig) {
act_url <-
parse_url(stringr::str_glue("https://www.strava.com/api/v3/activities/{id}/streams"))
access_token <- sig$credentials$access_token[[1]]
r <- modify_url(act_url,
query = list(
access_token = access_token,
keys = str_glue(
"distance,time,latlng,altitude,velocity_smooth,cadence,watts,
temp,moving,grade_smooth"
)
)) %>%
GET()
stop_for_status(r)
fromJSON(content(r, as = "text"), flatten = TRUE) %>%
as_tibble() %>%
mutate(id = id)
}</code></pre>
<p><br>
<font size="4"><strong>2. Bind the single targets into one data frame</strong></font>
<br>
You can do this using <code>dplyr::bind_rows()</code>.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">df_meas_all</td>
<td align="left">bind_rows(df_meas)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<p>The data now is represented by one row per measurement series:</p>
<pre class="r"><code>## # A tibble: 4,821 x 6
## type data series_type original_size resolution id
## <chr> <list> <chr> <int> <chr> <chr>
## 1 moving <lgl [4,706]> distance 4706 high 62186~
## 2 latlng <dbl [4,706 x 2]> distance 4706 high 62186~
## 3 velocity_smooth <dbl [4,706]> distance 4706 high 62186~
## 4 grade_smooth <dbl [4,706]> distance 4706 high 62186~
## 5 distance <dbl [4,706]> distance 4706 high 62186~
## 6 altitude <dbl [4,706]> distance 4706 high 62186~
## 7 heartrate <int [4,706]> distance 4706 high 62186~
## 8 time <int [4,706]> distance 4706 high 62186~
## 9 moving <lgl [301]> distance 301 high 62138~
## 10 latlng <dbl [301 x 2]> distance 301 high 62138~
## # ... with 4,811 more rows</code></pre>
<p><br>
<font size="4"><strong>3. Turn the data into a wide format</strong></font></p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">df_meas_wide</td>
<td align="left">meas_wide(df_meas_all)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<pre class="r"><code>meas_wide <- function(df_meas) {
pivot_wider(df_meas, names_from = type, values_from = data)
}</code></pre>
<p>In this format, every activity is one row again:</p>
<pre class="r"><code>## # A tibble: 605 x 14
## series_type original_size resolution id moving latlng velocity_smooth
## <chr> <int> <chr> <chr> <list> <list> <list>
## 1 distance 4706 high 6218628649 <lgl ~ <dbl ~ <dbl [4,706]>
## 2 distance 301 high 6213800583 <lgl ~ <dbl ~ <dbl [301]>
## 3 distance 4905 high 6179655557 <lgl ~ <dbl ~ <dbl [4,905]>
## 4 distance 10640 high 6160486739 <lgl ~ <dbl ~ <dbl [10,640]>
## 5 distance 4969 high 6153936896 <lgl ~ <dbl ~ <dbl [4,969]>
## 6 distance 2073 high 6115020306 <lgl ~ <dbl ~ <dbl [2,073]>
## 7 distance 1158 high 6097842884 <lgl ~ <dbl ~ <dbl [1,158]>
## 8 distance 8387 high 6091990268 <lgl ~ <dbl ~ <dbl [8,387]>
## 9 distance 5587 high 6073551706 <lgl ~ <dbl ~ <dbl [5,587]>
## 10 distance 5281 high 6057232328 <lgl ~ <dbl ~ <dbl [5,281]>
## # ... with 595 more rows, and 7 more variables: grade_smooth <list>,
## # distance <list>, altitude <list>, heartrate <list>, time <list>,
## # cadence <list>, watts <list></code></pre>
<p><br>
<font size="4"><strong>4. Preprocess and unnest the data</strong></font></p>
<p>The column <code>latlng</code> needs special attention, because it contains latitude and longitude information. Separate the two measurements before unnesting all list columns.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">df_meas_pro</td>
<td align="left">meas_pro(df_meas_wide)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<pre class="r"><code>meas_pro <- function(df_meas_wide) {
df_meas_wide %>%
mutate(
lat = map_if(
.x = latlng,
.p = ~ !is.null(.x),
.f = ~ .x[, 1]
),
lng = map_if(
.x = latlng,
.p = ~ !is.null(.x),
.f = ~ .x[, 2]
)
) %>%
select(-c(latlng, original_size, resolution, series_type)) %>%
unnest(where(is_list))
}</code></pre>
<p>After this step, every row is one point in time and every column is a measurement at this point in time (if there was any activity at that moment).</p>
<pre class="r"><code>## # A tibble: 2,176,926 x 12
## id moving velocity_smooth grade_smooth distance altitude heartrate time
## <chr> <lgl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 621862~ FALSE 0 1.8 0 527 149 0
## 2 621862~ TRUE 0 1.2 5 527. 150 1
## 3 621862~ TRUE 0 0.9 10.9 527. 150 2
## 4 621862~ TRUE 5.68 0.8 17 527. 150 3
## 5 621862~ TRUE 5.81 0.8 23.3 527. 150 4
## 6 621862~ TRUE 5.88 0.8 29.4 527. 150 5
## 7 621862~ TRUE 6.13 0.8 35.6 527. 151 6
## 8 621862~ TRUE 6.15 0 41.6 527. 150 7
## 9 621862~ TRUE 6.14 0 47.8 527. 150 8
## 10 621862~ TRUE 6.13 0.8 53.9 527. 150 9
## # ... with 2,176,916 more rows, and 4 more variables: cadence <dbl>,
## # watts <dbl>, lat <dbl>, lng <dbl></code></pre>
</div>
<div id="create-visualisation" class="section level2">
<h2>Create Visualisation</h2>
<p>Visualize the final data by displaying the geospatial information in the data. Every facet is one activity. Keep the rest of the plot as minimal as possible.</p>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">command</th>
<th align="left">pattern</th>
<th align="left">cue_mode</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">gg_meas</td>
<td align="left">vis_meas(df_meas_pro)</td>
<td align="left">NA</td>
<td align="left">thorough</td>
</tr>
</tbody>
</table>
<pre class="r"><code>vis_meas <- function(df_meas_pro) {
df_meas_pro %>%
filter(!is.na(lat)) %>%
ggplot(aes(x = lng, y = lat)) +
geom_path() +
facet_wrap( ~ id, scales = "free") +
theme(
axis.line = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.ticks = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
legend.position = "bottom",
panel.background = element_blank(),
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.background = element_blank(),
strip.text = element_blank()
)
}</code></pre>
<p><img src="gg_meas.png" width="1050" /></p>
<p>And there it is: All your Strava data in a few tidy data frames and a nice-looking plot. Future updates to the data shouldn’t take too long, because only measurements from new activities will be downloaded. With all your Strava data up to date, there are a lot of appealing possibilities for further data analyses of your fitness data.</p>
<p><em>Note from the Editor: Julian’s post neatly breaks down complex tasks, walking readers through the steps as well as rationale of his decisions. His use of the targets package demonstrates how an organized workflow enables replicability and ease. In addition, Julian showcases how the R programming language can fulfill a vision sparked by one’s passions. It is an inspiring example of how we can use R to create something that is informative, beautiful, and personal.</em></p>
</div>
<div class="footnotes">
<hr />
<ol>
<li id="fn1"><p>You can edit your R environment by running <code>usethis::edit_r_environ()</code>, saving the keys, and then restarting R.<a href="#fnref1" class="footnote-back">↩︎</a></p></li>
</ol>
</div>
<script>window.location.href='https://rviews.rstudio.com/2021/11/22/strava-data/';</script>
Deploying xaringan Slides with GitHub Pages
https://rviews.rstudio.com/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/
Thu, 18 Nov 2021 00:00:00 +0000https://rviews.rstudio.com/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/
<script src="/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/index_files/header-attrs/header-attrs.js"></script>
<script src="/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/index_files/clipboard/clipboard.min.js"></script>
<link href="/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/index_files/xaringanExtra-clipboard/xaringanExtra-clipboard.css" rel="stylesheet" />
<script src="/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/index_files/xaringanExtra-clipboard/xaringanExtra-clipboard.js"></script>
<script>window.xaringanExtraClipboard(null, {"button":"<i class=\"fa fa-clipboard\"><\/i> Copy Code","success":"<i class=\"fa fa-check\" style=\"color: #90BE6D\"><\/i> Copied!","error":"Press Ctrl+C to Copy"})</script>
<link href="/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/index_files/font-awesome/css/all.css" rel="stylesheet" />
<link href="/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/index_files/font-awesome/css/v4-shims.css" rel="stylesheet" />
<script src="/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/index_files/fitvids/fitvids.min.js"></script>
<p><em>Silvia Canelón is a researcher, community organizer, and R educator. Her research leverages electronic health record data to study pregnancy-related outcomes, and her organizing values data literacy and communication as ways to build power and effect change.</em></p>
<p>This post will guide you step-by-step through the process of creating an HTML xaringan slide deck and deploying it to the web for easy sharing with others. We will be using the <code>xaringan</code> package to build the slide deck, GitHub to help us host our slides for free with GitHub Pages, and the <code>usethis</code> package to help us out along the way. You will get the most out of this workflow if you are already familiar with R Markdown and GitHub, and if you have already connected RStudio (or your preferred IDE) to Git and GitHub.<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> The post will not cover the nuts and bolts of xaringan or talk about slide design & customization, but you can find lots of <a href="#learn-more">learning resources</a> listed at the end.</p>
<div id="choose-your-own-adventure" class="section level1">
<h1>Choose your own adventure</h1>
<ul>
<li><p><strong>Option 1:</strong> Start at the <a href="#the-ten-step-workflow">beginning of the workflow</a> to make a slide deck using the R Markdown template built into the <code>xaringan</code> package. The built-in template doubles as documentation for the <code>xaringan</code> package, so it is a great way to familiarize yourself with the package features, but it also includes a lot of content that will probably want to remove and modify when creating your presentation.</p></li>
<li><p><strong>Option 2:</strong> Start with an <a href="https://spcanelon.github.io/RLadies-xaringan-template">R-Ladies themed xaringan template</a> (embedded below). This is an example slide deck originally created as a teaching tool to highlight some of the main features of the <code>xaringan</code> package, and to demo some customization that incorporates the R-Ladies CSS theme built into xaringan. Please feel welcome to use/modify it to suit your needs! When you are ready, you can follow the steps immediately below 👇 to download the files to your machine, and then skip down to <a href="#initialize-version-control-with-git">Initialize version control with git</a>.</p></li>
</ul>
<pre class="r"><code>usethis::use_course(
repo_spec = "spcanelon/RLadies-xaringan-template",
destdir = "filepath/for/your/presentation"
)</code></pre>
<p><br></p>
<blockquote>
<p>Note: After copying the files to your machine you’ll probably want to rename the file folder to whatever makes sense for your presentation.</p>
</blockquote>
<p><br></p>
<div class="shareagain" style="min-width:300px;margin:1em auto;">
<iframe src="https://spcanelon.github.io/RLadies-xaringan-template" width="400" height="300" style="border:2px solid currentColor;" loading="lazy" allowfullscreen></iframe>
<script>fitvids('.shareagain', {players: 'iframe'});</script>
</div>
<p><br></p>
<blockquote>
<p>Try navigating through the slides ☝️ with your left/right arrow keys and press the letter “P” on your keyboard to see some notes in Presenter View.</p>
</blockquote>
</div>
<div id="the-ten-step-workflow" class="section level1">
<h1>The Ten-Step Workflow</h1>
<div id="packages" class="section level2">
<h2>Packages</h2>
<p>This workflow was developed using:</p>
<table>
<thead>
<tr class="header">
<th>Software / package</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>R</td>
<td>4.0.3</td>
</tr>
<tr class="even">
<td>RStudio</td>
<td>1.4.1103</td>
</tr>
<tr class="odd">
<td><code>xaringan</code></td>
<td>0.19</td>
</tr>
<tr class="even">
<td><code>usethis</code></td>
<td>2.0.0</td>
</tr>
</tbody>
</table>
<pre class="r"><code>install.packages("xaringan")
install.packages("usethis")</code></pre>
</div>
<div id="creating-your-xaringan-slide-deck" class="section level2">
<h2>Creating your xaringan slide deck</h2>
<p><strong>1. Create a new RStudio project for your presentation:</strong></p>
<pre class="r"><code>usethis::create_project("filepath/for/your/presentation/repo-name")</code></pre>
<p><br></p>
<blockquote>
<p>📍 If you’re not sure where you are on your computer, check your working directory with <code>getwd()</code> and use it as a filepath reference point</p>
</blockquote>
<!--Output:
```r
New project 'rladies-xaringan-template' is nested inside an existing project '/filepath/for/the/presentation/', which is rarely a good idea.
If this is unexpected, the here package has a function, `here::dr_here()` that reveals why '/filepath/for/the/presentation/' is regarded as a project.
Do you want to create anyway?
1: Absolutely not
2: Yup
3: No
Selection: 2
```
-->
<p><br></p>
<p><strong>2. Create a xaringan deck using a xaringan template:</strong><br>
<em>File</em> > <em>New File</em> > <em>R Markdown</em> > <em>From Template</em> > <em>Ninja Presentation</em> > <em>OK</em></p>
<p><strong>3. Delete what you don’t need and save your R Markdown file with whatever name you like.</strong> If you pick <code>index.Rmd</code> the live link you share at the end will be relatively short.</p>
<p><strong>4. Render HTML slides from the open Rmd file using xaringan’s infinite moon reader:</strong></p>
<pre class="r"><code> xaringan::infinite_moon_reader()</code></pre>
</div>
<div id="initialize-version-control-with-git" class="section level2">
<h2>Initialize version control with git</h2>
<p><strong>5. Initialize version control of your slides with git:</strong></p>
<pre class="r"><code>usethis::use_git()</code></pre>
<p><br></p>
<p>You’ll be asked if you want to commit the files in your project (with the message “Initial commit”) and then if you want to restart to activate the Git pane. Say yes to both ✅
<br></p>
<blockquote>
<p>Note: At the moment <code>usethis</code> names the primary branch “master” by default. <a href="https://github.com/r-lib/usethis/issues/1341">Issue #1341</a> suggests the option to instead name it “main” is in the works.</p>
</blockquote>
<!--Output:
> usethis::use_git()
✓ Setting active project to '/filepath/for/the/presentation/rladies-xaringan-template'
✓ Initialising Git repo
✓ Adding '.Rhistory', '.Rdata', '.httr-oauth', '.DS_Store' to '.gitignore'
There are 6 uncommitted files:
* '.gitignore'
* 'index_files/'
* 'index.html'
* 'index.Rmd'
* 'libs/'
* 'rladies-xaringan-template.Rproj'
Is it ok to commit them?
1: Yup
2: Negative
3: No way
Selection: 1
✓ Adding files
✓ Making a commit with message 'Initial commit'
● A restart of RStudio is required to activate the Git pane
Restart now?
1: Yes
2: Nope
3: Not now
Selection:
-->
<p><br></p>
<p><strong>6. Connect your local project with a GitHub repo:</strong></p>
<pre class="r"><code>usethis::use_github()</code></pre>
<p><br></p>
<blockquote>
<p>You could use the function argument <code>private = TRUE</code> to create a private GitHub repository. But you may have to remember to change the visibility before <a href="#deploying-your-slides">deploying to GitHub Pages</a>.</p>
</blockquote>
<!--Output:
> usethis::use_github(private = TRUE)
ℹ Defaulting to https Git protocol
✓ Setting active project to '/filepath/for/the/presentation/rladies-xaringan-template'
✓ Checking that current branch is default branch ('master')
✓ Creating private GitHub repository 'spcanelon/rladies-xaringan-template'
✓ Setting remote 'origin' to 'https://github.com/spcanelon/rladies-xaringan-template.git'
✓ Pushing 'master' branch to GitHub and setting 'origin/master' as upstream branch
✓ Opening URL 'https://github.com/spcanelon/rladies-xaringan-template'
-->
<p><br><br />
<strong>7. Your new GitHub repo with all of your xaringan project files will automatically open up in your browser</strong></p>
<blockquote>
<p>Repo for the R-Ladies xaringan template:<br>
<a href="https://github.com/spcanelon/RLadies-xaringan-template" class="uri">https://github.com/spcanelon/RLadies-xaringan-template</a></p>
</blockquote>
</div>
<div id="making-and-committing-changes-to-your-slides" class="section level2">
<h2>Making and committing changes to your slides</h2>
<p><strong>8. Edit your slides as you wish.</strong> Commit often! And then push to GitHub. Use the tools provided by the Git pane in RStudio, or use the following commands in the Terminal:</p>
<pre class="bash"><code># Step 1: Stage all modified files
git add .</code></pre>
<p><br></p>
<pre class="bash"><code># Step 2: Describe the changes you made to your files
git commit -m "<A brief but descriptive commit message>"</code></pre>
<p><br></p>
<blockquote>
<p>Consider writing a commit message that finishes the following sentence:<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a> “If applied, this commit will…” (e.g. “Change the slide theme”, “Add hello slide”)</p>
</blockquote>
<p><br></p>
<pre class="bash"><code># Step 3: Push the changes to your GitHub repository
git push</code></pre>
</div>
<div id="deploying-your-slides" class="section level2">
<h2>Deploying your slides</h2>
<p><strong>9. When you’re ready to deploy your slides, you can use the <code>usethis::use_github_pages()</code> function</strong> which makes the process of deploying via GitHub Pages super easy. I recommend pointing <code>branch</code> to the name of your primary branch.</p>
<pre class="r"><code>usethis::use_github_pages(branch = "master")</code></pre>
<p><br></p>
<blockquote>
<p>Note: Your repository must be <strong>public</strong> for your deployed slides to be available publicly, unless you have a paid GitHub account.</p>
</blockquote>
<p><br></p>
<blockquote>
<p>Also, you only need to follow this step <em>once</em> to deploy your slides to the web. As long as you remember to push to your repo any changes that you make to your slides (Rmd and HTML), GitHub Pages will know how to render them.</p>
</blockquote>
<!--Output:
> usethis::use_github_pages(branch = "master")
✓ Setting active project to '/Users/scanelon/Box/2-Teaching/R-Projects/R-Ladies/RLadies-xaringan-template'
✓ Activating GitHub Pages for 'spcanelon/rladies-xaringan-template'
✓ GitHub Pages is publishing from:
● URL: 'https://spcanelon.github.io/RLadies-xaringan-template/'
● Branch: 'master'
● Path: '/'
-->
<p><strong>10. Visit the link provided to see your newly deployed slides!</strong> 🚀<br>Don’t panic if you don’t see them right away, sometimes it takes a little time. This is the link you will share with the world when you present. Notice it looks <em>very</em> similar to your GitHub repo link.
<br></p>
<blockquote>
<p>Link to the R-Ladies xaringan template rendered slides:<br>
<a href="https://spcanelon.github.io/RLadies-xaringan-template" class="uri">https://spcanelon.github.io/RLadies-xaringan-template</a></p>
</blockquote>
</div>
</div>
<div id="bonus-steps" class="section level1">
<h1>Bonus steps</h1>
<p>11. Go to the <a href="https://github.com/spcanelon/RLadies-xaringan-template">repository home page</a> and find the About section on the right hand side. Add a description of your presentation and the link to your slides, that way your presentation is easily available to anyone visiting your repo.</p>
<p>12. Check out Garrick Aden-Buie’s blog post Sharing Your xaringan Slides to learn how to <a href="https://www.garrickadenbuie.com/blog/sharing-xaringan-slides/#create-a-social-media-card">create a social media card</a> for your slides and use your new link to share your slides in more places (e.g. <a href="https://www.garrickadenbuie.com/blog/sharing-xaringan-slides/#embed-your-slides">embedded on a website</a>, etc.)</p>
<p>13. This GitHub Pages workflow is not exclusive to xaringan slides! Try it out with any other HTML file.</p>
</div>
<div id="learn-more" class="section level1">
<h1>Learn more</h1>
<div id="foundation" class="section level2">
<h2>Foundation</h2>
<ul>
<li><a href="https://spcanelon.github.io/xaringan-basics-and-beyond/index.html">Sharing Your Work with xaringan • Silvia Canelón</a> – workshop site</li>
<li><a href="https://silvia.rbind.io/talk/2020-12-17-introduccion-xaringan/">Introducción al Paquete xaringan • Silvia Canelón</a> – R-Ladies Meetup</li>
<li><a href="https://arm.rbind.io/slides/xaringan.html">Making Slides with R Markdown • Alison Hill</a> – workshop slides</li>
<li><a href="https://slides.yihui.org/xaringan/">Presentation Ninja • xaringan Official Document</a> – package documentation</li>
<li><a href="https://bookdown.org/yihui/rmarkdown/xaringan.html">Chapter 7 xaringan Presentations • R Markdown: The Definitive Guide</a> – book chapter</li>
</ul>
</div>
<div id="sharing-your-slides" class="section level2">
<h2>Sharing your slides</h2>
<ul>
<li><a href="https://www.garrickadenbuie.com/blog/sharing-xaringan-slides/">Sharing Your xaringan Slides • Garrick Aden‑Buie</a> – blog post</li>
<li><a href="https://jhelvy.github.io/xaringanBuilder/">Functions For Building Xaringan Slides To Different Outputs. • xaringanBuilder</a> – package site</li>
<li><a href="https://alison.rbind.io/talk/2020-sharing-short-notice/">Sharing on Short Notice • Alison Hill & Desirée De Leon</a> – video resource for deploying via Netlify</li>
</ul>
</div>
<div id="making-your-slides-extra-special" class="section level2">
<h2>Making your slides extra special</h2>
<ul>
<li><a href="https://presentable-user2021.netlify.app/">Professional, Polished, Presentable • Garrick Aden‑Buie & Silvia Canelón • useR!2021</a> – workshop site</li>
<li><a href="https://github.com/yihui/xaringan/wiki">Home · yihui/xaringan Wiki • GitHub</a> – wiki of customizations for xaringan</li>
<li><a href="https://www.garrickadenbuie.com/talk/extra-great-slides-nyhackr/">Making Extra Great Slides • Garrick Aden‑Buie</a> – talk & slides with xaringan overview and featuring CSS styling and xaringanthemer</li>
<li><a href="https://www.katiejolly.io/blog/2021-03-16/designing-slides">Applying design guidelines to slides with {xaringanthemer} • katie jolly</a> – blog post</li>
<li><a href="https://pkg.garrickadenbuie.com/xaringanExtra/#/?id=xaringanextra">A playground of extensions for xaringan • xaringanExtra</a> – package site</li>
<li><a href="https://pkg.garrickadenbuie.com/xaringanthemer/">Custom xaringan CSS Themes • xaringanthemer</a> – package site</li>
</ul>
<p><em>Note from the Editor: Silvia’s post is a mini masterpiece of clear, concise writing that elucidates complex technology within the narrow context of explaining a single well-defined task. Silvia does not attempt to say everything she knows about the subject, and she resists digressions that might obscure the path she is laying out. It is an example of achieving clarity through saying less.</em></p>
</div>
</div>
<div class="footnotes">
<hr />
<ol>
<li id="fn1"><p><a href="https://happygitwithr.com/rstudio-git-github.html">Chapter 12 Connect RStudio to Git and GitHub | Happy Git and GitHub for the useR</a><a href="#fnref1" class="footnote-back">↩︎</a></p></li>
<li id="fn2"><p><a href="https://chris.beams.io/posts/git-commit/#imperative">How to Write a Git Commit Message | Chris Beams</a><a href="#fnref2" class="footnote-back">↩︎</a></p></li>
</ol>
</div>
<script>window.location.href='https://rviews.rstudio.com/2021/11/18/deploying-xaringan-slides-a-ten-step-github-pages-workflow/';</script>
An R Community Public Library
https://rviews.rstudio.com/2021/11/04/bookdown-org/
Thu, 04 Nov 2021 00:00:00 +0000https://rviews.rstudio.com/2021/11/04/bookdown-org/
<p>If you haven’t recently visited <a href="https://bookdown.org/">bookdown.org</a>, RStudio’s free site for publishing books written with the <a href="https://github.com/rstudio/bookdown">bookdown</a> R package, you many be amazed at what is available. Currently, there are over one hundred fifty titles listed under the <a href="https://bookdown.org/home/archive/">Books</a> tab. These are written in a panoply of languages including Bulgarian, Chinese, English, French, German, Hindi, Italian, Japanese, Korean, Lithuanian (maybe), Norwegian, Portuguese, Russian, Slovenian (I think) and Vietnamese. The breadth of topics is extraordinary! Most books are concerned with R programming or statistical analyses, but you can find the odd volume of <a href="https://bookdown.org/gorodnichy/andre/">Russian poetry</a> or treatise on <a href="https://blairfix.github.io/capital_as_power/why-write-a-book-about-capital.html#capitalism-without-capital">Capital</a>. Even with the aid of the bubble chart of tags there are hours of browsing here.</p>
<iframe id="tags"
title="Bookdown Topics"
width="100%"
height="300"
src="https://bookdown.org/home/tags/">
</iframe>
<p>The sophistication of the content ranges from student notes to texts that have been published in hardcover. The latter include:</p>
<ul>
<li><a href="https://adv-r.hadley.nz/">Advanced R</a></li>
<li><a href="https://advanced-r-solutions.rbind.io/">Advanced R Solutions</a></li>
<li><a href="https://bookdown.org/roback/bookdown-BeyondMLR/">Beyond Multiple Linear Regression</a></li>
<li><a href="https://bookdown.org/yihui/blogdown/">blogdown: Creating Websites with R Markdown</a></li>
<li><a href="https://bookdown.org/yihui/bookdown/">bookdown: Authoring Books and Technical Documents with R Markdown</a><br /></li>
<li><a href="https://blairfix.github.io/capital_as_power/">CAPITAL AS POWER: A Study of Order and Creorder</a></li>
<li><a href="https://bookdown.org/aclark/chess/">Chess Encounters</a></li>
<li><a href="https://jokergoo.github.io/ComplexHeatmap-reference/book/">ComplexHeatmap Complete Reference</a></li>
<li><a href="https://compgenomr.github.io/book/">Computational Genomics with R</a></li>
<li><a href="https://www.datascienceatthecommandline.com/1e/">Data Science at the Command Line, 1e </a><br /></li>
<li><a href="https://datascienceineducation.com/">Data Science in Education Using R</a><br /></li>
<li><a href="https://livebook.datascienceheroes.com/">Data Science Live Book</a><br /></li>
<li><a href="https://rkabacoff.github.io/datavis/">Data Visualization with R</a><br /></li>
<li><a href="https://csgillespie.github.io/efficientR/">https://csgillespie.github.io/efficientR/</a></li>
<li><a href="https://engineering-shiny.org/">Engineering Production-Grade Shiny Apps</a></li>
<li><a href="https://bookdown.org/rdpeng/exdata/">Exploratory Data Analysis with R</a></li>
<li><a href="https://ema.drwhy.ai/">Explanatory Model Analysis</a></li>
<li><a href="https://otexts.com/fpp2/">Forecasting: Principles and Practice (2nd ed)</a></li>
<li><a href="https://clauswilke.com/dataviz/">Fundamentals of Data Visualization</a></li>
<li><a href="https://geocompr.robinlovelace.net/">Geocomputation with R</a><br /></li>
<li><a href="https://rstudio-education.github.io/hopr/">Hands-On Programming with R</a></li>
<li><a href="https://plotly-r.com/">Interactive web-based data visualization with R, plotly, and shiny</a></li>
<li><a href="https://rafalab.github.io/dsbook/">Introduction to Data Science</a><br /></li>
<li><a href="https://rc2e.com/">R Cookbook, 2nd Edition</a></li>
<li><a href="https://r4ds.had.co.nz/">R for Data Science</a></li>
<li><a href="https://argoshare.is.ed.ac.uk/healthyr_book/">R for Health Data Science</a></li>
<li><a href="https://r-graphics.org/">R Graphics Cookbook, 2nd edition</a></li>
<li><a href="https://gedevan-aleksizde.github.io/rmarkdown-cookbook/">R Markdown</a><br /></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/">R Markdown Cookbook</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown/">R Markdown: The Definitive Guide</a><br /></li>
<li><a href="https://r-pkgs.org/">R Packages</a></li>
<li><a href="https://bookdown.org/rdpeng/rprogdatascience/">R Programming for Data Science</a></li>
<li><a href="https://moderndive.com/">Statistical Inference via Data Science</a></li>
<li><a href="https://bookdown.org/pbaumgartner/wiss-arbeiten/">Studieren und Forschen mit dem Internet</a><br /></li>
<li><a href="https://smltar.com/">Supervised Machine Learning for Text Analysis in R</a></li>
<li><a href="https://bookdown.org/rbg/surrogates/">Surrogates</a><br /></li>
<li><a href="https://info201.github.io/">Technical Foundations of Informatics</a></li>
<li><a href="https://www.tidytextmining.com/">Text Mining with R</a></li>
</ul>
<p>Happy Reading!! And, please let us know if you would like review one of these books.</p>
<script>window.location.href='https://rviews.rstudio.com/2021/11/04/bookdown-org/';</script>
September 2021: "Top 40" New CRAN Packages
https://rviews.rstudio.com/2021/10/28/september-2021-top-40-new-cran-packages/
Thu, 28 Oct 2021 00:00:00 +0000https://rviews.rstudio.com/2021/10/28/september-2021-top-40-new-cran-packages/
<p>Two hundred twenty new packages stuck to CRAN in September. Here are my “Top 40” picks in fourteen categories: Art, Computational Methods, Data, Econometrics, Finance and Insurance, Genomics, Machine Learning, Medicine, Networks and Graphs, Science, Statistics, Time Series, Utilities, and Visualization.</p>
<h3 id="art">Art</h3>
<p><a href="https://cran.r-project.org/package=rfishdraw">rfishdraw</a> v0.1.0: Automatically generates fish drawings using the <a href="https://github.com/LingDong-/fishdraw">fishdraw</a> JavaScript library. See the <a href="https://cran.r-project.org/web/packages/rfishdraw/vignettes/rfishdraw-vegnette.html">vignette</a>.</p>
<p><img src="rfishdraw.png" height = "300" width="500" alt="Line drawing of a fish"></p>
<h3 id="computational-mehods">Computational Mehods</h3>
<p><a href="https://cran.r-project.org/package=abmR">abmR</a> v1.0.4: Supplies tools for running agent-based models (ABM) as discussed in <a href="https://www.biorxiv.org/content/10.1101/2021.09.15.460374v1">Gochanour et al. (2021)</a> including two movement functions based on the <a href="https://journals.aps.org/pr/abstract/10.1103/PhysRev.36.823">Ornstein-Uhlenbeck model (1930)</a>. See the <a href="https://www.bengochanour.com/abmr">vignette</a> to get started.</p>
<p><img src="abmR.png" height = "400" width="400" alt="Simulated movement on a map of Europe"></p>
<p><a href="https://cran.r-project.org/package=SemiEstimate">SemiEstimate</a> v1.1.3: Implements an improved method of two-step Newton-Raphson iteration based on <a href="https://arxiv.org/abs/2108.07928">implicit profiling</a>. See the <a href="https://cran.r-project.org/web/packages/SemiEstimate/vignettes/Code.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=SimEngine">SimEngine</a> v1.0.0: Implements functions for structuring, maintaining, running, and debugging statistical simulations on both local and cluster-based computing environments. Emphasis is placed on <a href="https://avi-kenny.github.io/SimEngine/">documentation</a> and scalability. There is an <a href="https://cran.r-project.org/web/packages/SimEngine/vignettes/SimEngine.html">Introduction</a>, an example <a href="https://cran.r-project.org/web/packages/SimEngine/vignettes/example_1.html">Power Calculation</a>, and a vignette <a href="https://cran.r-project.org/web/packages/SimEngine/vignettes/example_2.html">Comparing SE Estimators</a>.</p>
<p><img src="SimEngine.png" height = "300" width="500" alt="Line plot comparing estimators"></p>
<h3 id="data">Data</h3>
<p><a href="https://cran.r-project.org/package=asylum">asylum</a> v1.0.1: Provides <a href="https://www.gov.uk/government/statistics/immigration-statistics-year-ending-june-2021">data on asylum and resettlement</a> from the UK Home Office. See <a href="https://cran.r-project.org/web/packages/asylum/readme/README.html">README</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=hockeyR">hockeyR</a> v0.1.1: Provides functions to scrape hockey play-by-play data from <a href="https://www.nhl.com/">NHL.com</a> and <a href="https://www.hockey-reference.com/">Hockey-Reference.com</a> including standings, player stats, and jersey number history. There is a <a href="https://cran.r-project.org/web/packages/hockeyR/vignettes/hockeyR.html">Getting Started Guide</a> and a vignette on <a href="https://cran.r-project.org/web/packages/hockeyR/vignettes/hockey-ref-scrapers.html">Scraping</a>.</p>
<p><a href="https://cran.r-project.org/package=yowie">yowie</a> v0.1.0: Provides longitudinal wages data sets and several demographic variables from the <a href="https://www.nlsinfo.org/content/cohorts/nlsy79/get-data">National Longitudinal Survey of Youth</a> from 1979 to 2018 including: the wages data from the cohort whose highest grade completed is up to high school; the wages data of the high school dropouts and; the demographic data of the cohort in the survey year 1979. See the <a href="https://cran.r-project.org/web/packages/yowie/vignettes/intro.html">vignette</a> for details.</p>
<p><img src="yowie.png" height = "300" width="300" alt="Plots of wages data by year"></p>
<h3 id="econometrics">Econometrics</h3>
<p><a href="https://cran.r-project.org/package=COINr">COINr</a> v0.5.5: Implements a development environment for composite indicators and scoreboards including utilities for construction (indicator selection, denomination, imputation, data treatment, normalization, weighting and aggregation) and analysis (multivariate analysis, correlation plotting. Look <a href="https://bluefoxr.github.io/COINrDoc/">here</a> for an online book, and see the <a href="https://cran.r-project.org/web/packages/COINr/vignettes/Overview.html">vignette</a> for an extended overview.</p>
<p><img src="COINr.png" height = "400" width="400" alt="Plot of framework for an index"></p>
<p><a href="https://cran.r-project.org/package=spflow">spflow</a> v0.1.0: Provides functions to estimate spatial econometric models of origin-destination flows which may exhibit spatial autocorrelation in both the dependent variable and the explanatory variables. See <a href="https://onlinelibrary.wiley.com/doi/10.1111/j.1467-9787.2008.00573.x?__cf_chl_jschl_tk__=pmd_uU3GYgF2MB9QotpSVXhFXciPWWzPKYTf8SW7EHjxWmI-1635285331-0-gqNtZGzNAlCjcnBszQ8R">LeSage and Pace (2008)</a> for information on the model, <a href="https://www.tse-fr.eu/fr/publications/revisiting-estimation-methods-spatial-econometric-interaction-models">Dargel (2021)</a> for information on the estimation procedures, and the <a href="https://cran.r-project.org/web/packages/spflow/vignettes/paris_commute_flows.html">vignette</a> for examples.</p>
<p><img src="spflow.png" height = "300" width="300" alt="Spatial maps of population and other variables"></p>
<h3 id="finance-and-insurance">Finance and Insurance</h3>
<p><a href="https://cran.r-project.org/package=DOSPortfolio">DOSPortfolio</a> v0.1.0: Implements dynamic optimal shrinkage estimators for the weights of the global minimum variance portfolio reconstructed at given reallocation points as derived in <a href="https://arxiv.org/abs/2106.02131">Bodnar et al. (2021)</a>. See the <a href="https://cran.r-project.org/web/packages/DOSPortfolio/vignettes/introduction.html">Introduction</a>.</p>
<p><a href="https://cran.r-project.org/package=SPLICE">SPLICE</a> v1.0.0: Extends the individual claim simulator <a href="https://cran.r-project.org/package=SynthETIC">SynthETIC</a> to simulate the evolution of case estimates of incurred losses through the lifetime of an insurance claim. See <a href="https://arxiv.org/abs/2109.04058">Taylor & Wang (2021)</a> for background and the <a href="https://cran.r-project.org/web/packages/SPLICE/vignettes/SPLICE-demo.html">vignette</a> to get started.</p>
<h3 id="genomics">Genomics</h3>
<p><a href="https://cran.r-project.org/package=MAnorm2">MAnorm2</a> v1.2.0: Implements a method for normalizing ChIP-seq signals across individual samples or groups of samples and a system of statistical models for calling differential ChIP-seq signals between two or more biological conditions. Refer to <a href="https://genome.cshlp.org/content/31/1/131">Tu et al. (2021)</a> and <a href="https://www.biorxiv.org/content/10.1101/2021.07.27.453915v1">Chen et al. (2021)</a> for the statistical details. The <a href="https://cran.r-project.org/web/packages/MAnorm2/vignettes/MAnorm2_vignette.html">vignette</a> provides several examples.</p>
<p><img src="MAnorm2.png" height = "300" width="500" alt="Before and after normalization MA plots"></p>
<p><a href="https://cran.r-project.org/package=RevGadgets">RevGadgets</a> v1.0.0: Provides functions to process and visualize the output of complex phylogenetic analyses from the <a href="https://revbayes.github.io/">RevBayes</a> phylogenetic graphical modeling software. Look <a href="https://revbayes.github.io/tutorials/intro/revgadgets">here</a> for a tutorial.</p>
<p><img src="RevGadgets.png" height = "300" width="500" alt="Circular plot of ancestral-state estimates"></p>
<h3 id="machine-learning">Machine Learning</h3>
<p><a href="https://cran.r-project.org/package=morphemepiece">morphemepiece</a> v1.0.1: Provides functions to tokenize text into morphemes ether by table lookup or a modified wordpiece tokenization algorithm. There is a vignette on testing the <a href="https://cran.r-project.org/web/packages/morphemepiece/vignettes/algorithm_test.html">fall-through algorithm</a> and another on <a href="https://cran.r-project.org/web/packages/morphemepiece/vignettes/generating_vocab.html">Generating a Vocabulary</a>.</p>
<p><a href="https://cran.r-project.org/package=NIMAA">NIMAA</a> v0.1.0: Implements a pipeline for nominal data mining, which can effectively find special relationships between data. See <a href="https://www.biorxiv.org/content/10.1101/2021.03.18.436040v3">Jafari et al. (2021)</a> for a description of the method and the <a href="https://cran.r-project.org/web/packages/NIMAA/vignettes/NIMAA-vignette.html">vignette</a> for an introduction.</p>
<p><img src="NIMAA.png" height = "300" width="500" alt="Bipartite plot"></p>
<h3 id="medicine">Medicine</h3>
<p><a href="https://cran.r-project.org/package=gapclosing">gapclosing</a> v1.0.2: Provides functions to estimate the disparities across categories (e.g. Black and white) that persists if a treatment variable (e.g. college) is equalized. See <a href="https://osf.io/preprints/socarxiv/gx4y3/">Lundberg (2021)</a> for the methodology and the <a href="https://cran.r-project.org/web/packages/gapclosing/vignettes/gapclosing.html">vignette</a> for an overview with examples.</p>
<p><img src="gapclosing.png" height = "300" width="500" alt="Disparity plot of mean outcome by category"></p>
<p><a href="https://cran.r-project.org/package=iDOVE">iDOVE</a> v1.3: Implements a nonparametric maximum likelihood method for assessing potentially time-varying vaccine efficacy against SARS-CoV-2 infection under staggered enrollment and time-varying community transmission, allowing crossover of placebo volunteers to the vaccine arm. See <a href="https://academic.oup.com/cid/advance-article/doi/10.1093/cid/ciab630/6321290">Lin et al. (2021)</a> for background and the <a href="https://cran.r-project.org/web/packages/iDOVE/vignettes/iDOVE_vignette.pdf">vignette</a> for the details.</p>
<p><a href="https://cran.r-project.org/package=powerly">powerly</a> v1.5.2: Implements the sample size computation method for network models proposed by <a href="https://psyarxiv.com/j5v7u/">Constantin et al. (2021)</a> which takes the form of a three-step recursive algorithm to find an optimal sample size given a model specification and a performance measure of interest. See <a href="https://cran.r-project.org/web/packages/powerly/readme/README.html">README</a> for an example.</p>
<p><img src="powerly.png" height = "400" width="600" alt="Poster showing methodology"></p>
<p><a href="https://cran.r-project.org/package=ppseq">ppseq</a> v0.1.1: Provides functions to design clinical trials using sequential predictive probability monitoring. See the <a href="https://cran.r-project.org/web/packages/ppseq/vignettes/one_sample_expansion.html">vignette</a> for details.</p>
<h3 id="networks-and-graphs">Networks and Graphs</h3>
<p><a href="https://cran.r-project.org/package=multigraphr">multigrapher</a> v0.1.0: Implements methods and models for analyzing multigraphs as introduced by <a href="https://www.exeley.com/journal_of_social_structure/doi/10.21307/joss-2019-011">Shafie (2015)</a> including methods to study local and global properties and goodness of fit tests. See <a href="https://www.tandfonline.com/doi/abs/10.1080/0022250X.2016.1219732?journalCode=gmas20">Shafle (2016)</a>. The <a href="https://cran.r-project.org/web/packages/multigraphr/vignettes/multigraphr.html">vignette</a> provides an introduction.</p>
<p><img src="multigrapher.png" height = "400" width="600" alt="Examples of multigraphs"></p>
<p><a href="https://cran.r-project.org/package=nevada">nevada</a> v0.1.0: Implements a statistical framework for network-valued data analysis which leverages the complexity of the space of distributions on graphs. See <a href="https://www.sciencedirect.com/science/article/abs/pii/S0167947319302518?via%3Dihub">Lovato et al. (2020)</a> and <a href="https://rss.onlinelibrary.wiley.com/doi/10.1111/rssc.12463">Lovato et al. (2021)</a> for the statistical background, and the <a href="https://cran.r-project.org/web/packages/nevada/vignettes/nevada.html">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=robber">robber</a> v0.2.2: Implementation of a variety of methods to compute the robustness of ecological interaction networks with binary interactions as described in <a href="https://arxiv.org/abs/1910.10512">Chabert-Liddell et al. (2021)</a>. There is a vignette on <a href="https://cran.r-project.org/web/packages/robber/vignettes/topological-analysis.html">Topological Analysis</a>.</p>
<p><img src="robber.png" height = "400" width="400" alt="Plots comparing the influence of structure on robustness"></p>
<h3 id="science">Science</h3>
<p><a href="https://cran.r-project.org/package=argoFloats">argoFloats</a> v1.0.3: Supports the analysis of oceanographic data recorded by Argo autonomous drifting profiling floats. See <a href="https://www.frontiersin.org/articles/10.3389/fmars.2021.635922/full">Kelley et al. (2021)</a> for more on the scientific context and applications. There is an <a href="https://cran.r-project.org/web/packages/argoFloats/vignettes/argoFloats.html">Introduction</a> and a vignette on <a href="https://cran.r-project.org/web/packages/argoFloats/vignettes/qc.html">Quality Control and Adjusted Data</a>.</p>
<p><img src="argoFloats.png" height = "400" width="400" alt="Spatial plot of Arfo floats off the Bahamas"></p>
<p><a href="https://cran.r-project.org/package=biosurvey">biosurvey</a> v0.1.1: Provides tools that allow users to plan systems of sampling sites with the goals of increasing the efficiency of biodiversity monitoring. See <a href="https://onlinelibrary.wiley.com/doi/10.1111/j.1466-8238.2011.00662.x">Arita et al. (2011)</a> and <a href="https://journals.ku.edu/jbi/article/view/4801">Soberón & Cavner (2015)</a> for background. There are vignettes on <a href="https://cran.r-project.org/web/packages/biosurvey/vignettes/biosurvey_preparing_data.html">Preparing Data</a>, <a href="https://cran.r-project.org/web/packages/biosurvey/vignettes/biosurvey_selecting_sites.html">Selecting Sample Sites</a>, <a href="https://cran.r-project.org/web/packages/biosurvey/vignettes/biosurvey_selection_with_preselected_sites.html">Using Preselected Points</a>, and <a href="https://cran.r-project.org/web/packages/biosurvey/vignettes/biosurvey_testing_module.html">Testing Efficacy of Selected Sites</a>.</p>
<p><img src="biosurvey.png" height = "300" width="500" alt="Plots contrasting environmental space vs. geographic space"></p>
<p><a href="https://cran.r-project.org/package=HostSwitch">HostSwitch</a> v0.1.0: Provides functions to aims to investigate the dynamics of the host switch in the population of an organism that interacts with current and potential hosts over generations. The underlying model is based on <a href="https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0139225">Araujo et al. (2015)</a>. See the <a href="https://cran.r-project.org/web/packages/HostSwitch/vignettes/HostSwitch.html">vignette</a> for an example.</p>
<p><img src="HostSwitch.png" height = "300" width="500" alt="Plot of distributions of phenotypes by number of generations"></p>
<h3 id="statistics">Statistics</h3>
<p><a href="https://cran.r-project.org/package=cvam">cvam</a> v0.9.2: Extends R’s implementation of categorical variables (factors) to handle coarsened observations and implements log-linear models for coarsened categorical data, including latent-class models. There is a vignette describing <a href="https://cran.r-project.org/web/packages/cvam/vignettes/UnderstandingCoarsenedFactorsInCvam.pdf">Coarsened Factors</a> and another on <a href="https://cran.r-project.org/web/packages/cvam/vignettes/FittingLogLinearModelsInCvam.pdf">Fitting Log-linear Models</a>.</p>
<p><a href="https://cran.r-project.org/package=JustifyAlpha">JustifyAlpha</a> v0.1.1: Provides functions to justify alpha levels for statistical hypothesis tests by avoiding Lindley’s paradox, or by minimizing or balancing error rates. See <a href="https://psyarxiv.com/ts4r6/">Maier & Lakens (2021)</a> for the theory and the <a href="https://cran.r-project.org/web/packages/JustifyAlpha/vignettes/Introduction_to_JustifyAlpha.html">vignette</a> for an introduction.</p>
<p><img src="JustifyAlpha.png" height = "300" width="500" alt="Plots of error rate vs. alpha level"></p>
<p><a href="https://cran.r-project.org/package=sphunif">sphunif</a> v1.0.1: Implements functions to test for uniformity on circles and hyperspheres. See <a href="https://arxiv.org/abs/2008.09897">García-Portugués et al. (2020)</a> for background and the <a href="https://arxiv.org/abs/2008.09897">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=spatialRF">spatialRF</a> v1.1.3: Implements methods to automatically generate and select spatial predictors for spatial regression with Random Forest. See <a href="https://www.sciencedirect.com/science/article/abs/pii/S0304380006000925?via%3Dihub">Dray et al. (2006)</a> and RFsp <a href="https://peerj.com/articles/5518/">Hengl et al. (2017)</a>. Look <a href="https://blasbenito.github.io/spatialRF/">here</a> for documentation and examples.</p>
<p><img src="spatialRF.png" height = "400" width="400" alt="Grid of prediction graphs"></p>
<p><a href="https://cran.r-project.org/package=vdra">vdra</a> v1.0.0: Implements three protocols for performing secure linear, logistic, and Cox regression on vertically partitioned data across several data partners in such a way that data is not shared among data partners. See <a href="https://ieeexplore.ieee.org/document/4476748">Slavkovic et. al. (2007)</a> for background. There is an <a href="https://cran.r-project.org/web/packages/vdra/vignettes/An-Introduction-to-the-VDRA-Package.html">Introduction</a> and vignettes on <a href="https://cran.r-project.org/web/packages/vdra/vignettes/How-to-Use-the-VDRA-Package-with-PopMedNet.html">Using PopMedNet</a>, <a href="https://cran.r-project.org/web/packages/vdra/vignettes/VDRA-Communications-and-Files.html">Communications and Files</a>, and <a href="https://cran.r-project.org/web/packages/vdra/vignettes/VDRA-Workflow.html">Workflow</a>.</p>
<p><img src="vdra.png" height = "300" width="500" alt="Diagram of information flow among data partners"></p>
<h3 id="time-series">Time Series</h3>
<p><a href="https://cran.r-project.org/package=GlarmaVarSel">GlarmaVarSel</a> v1.0: Implements functions for variable selection in high-dimensional sparse GLARMA models. See <a href="https://arxiv.org/abs/2007.08623v1">Gomtsyan et al. (2020)</a> for the theory and the <a href="https://cran.r-project.org/web/packages/GlarmaVarSel/vignettes/GlarmaVarSel.html">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=mrf">mrf</a> v0.5.1: Implements a method to forecast univariate times series using a feature extraction algorithm based on the Haar wavelet transform. See the <a href="https://cran.r-project.org/web/packages/mrf/vignettes/mrf.html">vignette</a>.</p>
<p><img src="mrf.png" height = "300" width="500" alt="Plot of electricity demand"></p>
<h3 id="utilities">Utilities</h3>
<p><a href="https://cran.r-project.org/package=colorblindcheck">colorblindcheck</a> v1.0.0: Provides functions to compare color palettes with simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia. It includes a calculation of distances between colors and creates summaries of differences between color palettes and simulations of color vision deficiencies. See the <a href="http://www.vis4.net/blog/2018/02/automate-colorblind-checking/">post</a> by G. Aisch for background and the <a href="https://cran.r-project.org/web/packages/colorblindcheck/vignettes/intro-to-colorblindcheck.html">vignette</a> for details.</p>
<p><img src="colorblindcheck.png" height = "400" width="400" alt="Chart showing how colors ar perceived by people with various forms of colorblindness"></p>
<p><a href="https://cran.r-project.org/package=filearray">filearray</a> v0.1.1: Implements file-backed arrays for out-of-memory computation using gigabyte-level multi-threaded read/write via <code>OpenMP</code>. The <a href="https://cran.r-project.org/web/packages/filearray/vignettes/performance.html">vignette</a> compares performance with native R.</p>
<p><a href="https://cran.r-project.org/package=httr2">httr2</a> v0.1.1: Implements tools for creating and modifying HTTP requests, executing them, and then processing the results. <code>httr2</code> is a modern re-imagining of <code>httr</code> that uses a pipe-based interface and solves more of the problems that API wrapping packages face. See the vignettes <a href="https://cran.r-project.org/web/packages/httr2/vignettes/httr2.html">httr2</a> and <a href="https://cran.r-project.org/web/packages/httr2/vignettes/wrapping-apis.html">Wrapping APIs</a>.</p>
<p><a href="https://cran.r-project.org/package=quadtree">quadtree</a> v0.1.2: Provides region quadtrees for working with spatial data, which allow for variable-sized cells. There are vignettes on <a href="https://cran.r-project.org/web/packages/quadtree/vignettes/quadtree-code.html">code</a>, <a href="https://cran.r-project.org/web/packages/quadtree/vignettes/quadtree-creation.html">creation</a>, <a href="https://cran.r-project.org/web/packages/quadtree/vignettes/quadtree-lcp.html">lcp</a>, and <a href="https://cran.r-project.org/web/packages/quadtree/vignettes/quadtree-usage.html">usage</a>.</p>
<p><img src="quadtree.png" height = "300" width="500" alt="Illustration of Quadtree Structure"></p>
<p><a href="https://cran.r-project.org/package=tabxplor">tabxplor</a> v1.0.2: Implements tools to create, manipulate, and color highlight cross-tables, and export them to <code>Excel</code> or <code>HTML</code> with formats and colors. See the <a href="https://cran.r-project.org/web/packages/tabxplor/vignettes/tabxplor.html">vignette</a>.</p>
<p><img src="tabxplor.png" height = "300" width="500" alt="Table with color highlighting"></p>
<h3 id="visualization">Visualization</h3>
<p><a href="https://cran.r-project.org/package=bittermelon">bittermelon</a> v0.1.3: Provides functions for creating and modifying bitmaps with special emphasis on bitmap fonts and their glyphs including native read/write support for the <code>hex</code> and <code>yaff</code> bitmap font formats. Look <a href="https://trevorldavis.com/R/bittermelon/">here</a> for documentation.</p>
<p><img src="bittermelon.png" height = "300" width="300" alt="Bitmap rendering of a Go Board"></p>
<p><a href="https://CRAN.R-project.org/package=d3po">d3po</a> v0.3.2: Implements an Apache licensed alternative to <code>Highcharter</code> which provides functions for interactive visualization for <code>Markdown</code> and <code>Shiny</code>. See the <a href="https://cran.r-project.org/web/packages/d3po/vignettes/d3po.html">vignette</a> for examples.</p>
<p><img src="d3po.png" height = "400" width="400" alt="Example of bubblechart"></p>
<p><a href="https://cran.r-project.org/package=ggHoriPlot">ggHoriPlot</a> v1.0.0: implements <code>geom_horizon()</code> and other functions for building horizon plots with <code>ggplot2</code>. There is an <a href="https://cran.r-project.org/web/packages/ggHoriPlot/vignettes/ggHoriPlot.html">Introduction</a> and a <a href="https://cran.r-project.org/web/packages/ggHoriPlot/vignettes/examples.html">vignette</a> with examples.</p>
<p><img src="ggHoriPlot.png" height = "300" width="500" alt="Horizon plot showing content along human genome"></p>
<p><a href="https://cran.r-project.org/package=plotbb">plotbb</a> v0.0.6: Provides a proof of concept for implementing a grammar for base R plots.See the <a href="https://cran.r-project.org/web/packages/plotbb/vignettes/plotbb.html">vignette</a>.</p>
<p><img src="plotbb.png" height = "200" width="350" alt="Enhanced base R scatter plot"></p>
<p><a href="https://cran.r-project.org/package=semptools">semptools</a> v0.2.9.3: Implements functions for customizing structural equation plots that can be chained using a pipe operator. There is a <a href="https://cran.r-project.org/web/packages/semptools/vignettes/semptools.html">Quick Start Guide</a>, and vignettes on <a href="https://cran.r-project.org/web/packages/semptools/vignettes/keep_or_drop_nodes.html">Nodes</a>, <a href="https://cran.r-project.org/web/packages/semptools/vignettes/layout_matrix.html">Matrix Layout</a>, <a href="https://cran.r-project.org/web/packages/semptools/vignettes/quick_start_cfa.html">CFA</a>, and <a href="https://cran.r-project.org/web/packages/semptools/vignettes/quick_start_sem.html">SEM</a>.</p>
<p><img src="semptools.png" height = "400" width="400" alt="Plot depicting inter-factor covariances"></p>
<script>window.location.href='https://rviews.rstudio.com/2021/10/28/september-2021-top-40-new-cran-packages/';</script>
A beginner's guide to Shiny modules
https://rviews.rstudio.com/2021/10/20/a-beginner-s-guide-to-shiny-modules/
Wed, 20 Oct 2021 00:00:00 +0000https://rviews.rstudio.com/2021/10/20/a-beginner-s-guide-to-shiny-modules/
<script src="/2021/10/20/a-beginner-s-guide-to-shiny-modules/index_files/header-attrs/header-attrs.js"></script>
<p><em>This post by Emily Riederer is the winning entry in our recent <a href="https://rviews.rstudio.com/2021/08/04/r-views-blog-contest/">Call for Documentation</a> contest. Emily is a Senior Analytics Manager at Capital One where she leads a team building internal analytical tools including R packages, datamarts, and Shiny apps. Outside of work, Emily can be found sharing more code and ideas about analytics on her <a href="https://emilyriederer.netlify.com/">website</a>, Twitter (<span class="citation">@emilyriederer</span>) and GitHub (<span class="citation">@emilyriederer</span>).</em></p>
<p>Shiny modules are often taught as an advanced topic, but they can also be a great way for novice Shiny developers to start building more complex applications. If you already are an R user who likes to <strong>think and write functions</strong> and <strong>understand Shiny basics</strong> (i.e. reactivity), then modules <strong>for certain types of tasks</strong> (discussed at the end of this post) are an excellent way to up your game.</p>
<p>Shiny’s tendency toward monolithic scripts and <em>lack</em> of function-based thinking in introductory materials felt so unlike normal R programming. So, not only is it <em>possible</em> to learn modules early, it may actually be decidedly easier than the alternative depending on your frame of mind.</p>
<p>In this post, I walk through a toy example of building a reporting app from the <code>flights</code> data in the <a href="https://cran.r-project.org/package=nycflights13">nycflights13</a> package to demonstrate how modules help scale basic Shiny skills.</p>
<div id="why-modules" class="section level2">
<h2>Why Modules?</h2>
<p>Modules act like functions by wrapping up sets of Shiny UI and server elements. You may wonder why you cannot just accomplish this with the normal R functions. The reason for this is a bit technical and is explained well in <em>Mastering Shiny</em>. However, the technical knowledge needed to understand “why functions don’t work” should not make modules an advanced topic. If you see the value of writing functions, you are more than ready to take advantage of modules in app development.</p>
</div>
<div id="motivating-example" class="section level2">
<h2>Motivating Example</h2>
<p>For the sake of argument, let’s pretend that we are building an airline dashboard to track travel delays against established thresholds. We have the following requirements:</p>
<ul>
<li>Let users pick a month of interest to visualize</li>
<li>For each metric of interest, users should be able to:
<ul>
<li>See a time-series plot of the average daily value of the metric</li>
<li>Download a PNG of the plot</li>
<li>Read a text summary of how often the value breached the threshold</li>
</ul></li>
<li>The metrics of interest are:
<ul>
<li>Average departure delay</li>
<li>Average arrival delay</li>
<li>Proportion of daily flights with an arrival delay exceeding 5 minutes</li>
</ul></li>
</ul>
<p>Below is a preview of the final application. The full app is currently hosted in <a href="https://emilyriederer.shinyapps.io/shiny-modules-demo/">ShinyApps.io</a> and the code available <a href="https://github.com/emilyriederer/demo-shiny-modules">on GitHub</a>. It would not win any beauty contests, but its simple style allows us to focus on modules in the code.</p>
<div class="figure">
<img src="https://github.com/emilyriederer/docs-submission/blob/master/shiny-modules/app-photo.PNG?raw=true" alt="" />
<p class="caption">Two line graphs for departure and arrival times where we see variation compared to the average</p>
</div>
</div>
<div id="set-up" class="section level2">
<h2>Set-Up</h2>
<pre class="r"><code>library(shiny)
library(nycflights13)
library(dplyr)</code></pre>
<pre><code>##
## Attaching package: 'dplyr'</code></pre>
<pre><code>## The following objects are masked from 'package:stats':
##
## filter, lag</code></pre>
<pre><code>## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union</code></pre>
<pre class="r"><code>library(ggplot2)</code></pre>
<p>To understand the following explanation, it helps to familiarize yourself with the data. We filter the <code>flights</code> data down to a single airline and aggregate the results by day.</p>
<pre class="r"><code>ua_data <-
nycflights13::flights %>%
filter(carrier == "UA") %>%
mutate(ind_arr_delay = (arr_delay > 5)) %>%
group_by(year, month, day) %>%
summarize(
n = n(),
across(ends_with("delay"), mean, na.rm = TRUE)
) %>%
ungroup()</code></pre>
<pre><code>## `summarise()` has grouped output by 'year', 'month'. You can override using the `.groups` argument.</code></pre>
<pre class="r"><code>head(ua_data)</code></pre>
<pre><code>## # A tibble: 6 x 7
## year month day n dep_delay arr_delay ind_arr_delay
## <int> <int> <int> <int> <dbl> <dbl> <dbl>
## 1 2013 1 1 165 7.65 6.27 0.476
## 2 2013 1 2 170 12.8 7.04 0.458
## 3 2013 1 3 159 8.66 -2.76 0.357
## 4 2013 1 4 161 6.84 -9.86 0.180
## 5 2013 1 5 117 9.66 0.786 0.274
## 6 2013 1 6 137 9.79 3.53 0.409</code></pre>
<p>Next, we define the plotting function that we will use to visualize a month-long timeseries of data for each metric.</p>
<pre class="r"><code>viz_monthly <- function(df, y_var, threshhold = NULL) {
ggplot(df) +
aes(
x = .data[["day"]],
y = .data[[y_var]]
) +
geom_line() +
geom_hline(yintercept = threshhold, color = "red", linetype = 2) +
scale_x_continuous(breaks = seq(1, 29, by = 7)) +
theme_minimal()
}</code></pre>
<p>For example, to visualize the average arrival delay by day for all of March and compare it to a threshold of 10 minutes, we can write:</p>
<pre class="r"><code>ua_data %>%
filter(month == 3) %>%
viz_monthly("arr_delay", threshhold = 10)</code></pre>
<p><img src="/2021/10/20/a-beginner-s-guide-to-shiny-modules/index_files/figure-html/unnamed-chunk-4-1.png" width="672" /></p>
</div>
<div id="one-module-at-a-time" class="section level2">
<h2>One Module at a Time</h2>
<p>Modules don’t just help organize your code; they help you organize your <em>thinking</em>. Given our app requirements, it might feel overwhelming where to start. Filtering the data? Making the plots? Wiring up buttons? Inevitably, when juggling many components, you’re likely to introduce a bug by copy-pasting a line with the wrong <code>id</code> or getting nested parentheses out of whack.</p>
<p>Instead, modules essentially allow your to write <em>many simple Shiny apps</em> and compose them together.</p>
<p>For example, we might decide that first we just want to focus on a very simple app: given a monthly subset of the data, a metric, and a threshold of interest. Let’s write a simple text summary of the flights performance. We now know we just need to define a UI (<code>text_ui</code>) with a single call to <code>textOutput()</code>, a server (<code>text_server</code>) that does a single calculation and calls <code>renderText()</code>. Best of all, we can immediately see whether or not our “app” works by writing a minimalist testing function (<code>text_demo</code>) which renders the text for a small, fake dataset.</p>
<p>Those steps are implemented in a file called <code>mod-text.R</code>:</p>
<p>You can find all of the code for this tutorial in this <a href="https://github.com/emilyriederer/demo-shiny-modules">demo Shiny application</a> repository.
We can follow the same pattern to create a module for the plot itself (in the file <a href="https://github.com/emilyriederer/demo-shiny-modules/blob/master/mod-plot.R"><code>mod-plot.R</code></a>) consisting of a UI (<code>plot_ui</code>), a server (<code>plot_server</code>), and a testing function (<code>plot_demo</code>). This module is responsible for plotting one metric and allowing users to download the results.</p>
</div>
<div id="composing-modules" class="section level2">
<h2>Composing Modules</h2>
<p>We now have a text module and a plot module. However, for each metric of interest, we want to produce <em>both</em>. We could call these two modules one-at-a-time, but we can also compose multiple modules together so that we can produce in single commands everything that we need for a given metric.</p>
<p>With all of the underlying plot and text module logic abstracted, our metric module definition (in the <code>mod-metr.R</code> file) is very clean and simple:</p>
<pre class="r"><code># metric module ----
metric_ui <- function(id) {
fluidRow(
text_ui(NS(id, "metric")),
plot_ui(NS(id, "metric"))
)
}
metric_server <- function(id, df, vbl, threshhold) {
moduleServer(id, function(input, output, session) {
text_server("metric", df, vbl, threshhold)
plot_server("metric", df, vbl, threshhold)
})
}
metric_demo <- function() {
df <- data.frame(day = 1:30, arr_delay = 1:30)
ui <- fluidPage(metric_ui("x"))
server <- function(input, output, session) {
metric_server("x", reactive({df}), "arr_delay", 15)
}
shinyApp(ui, server)
}</code></pre>
<p>Again, we can test that these components went together as we intended by running the <code>metric_demo()</code> function. We see the text from our text module on top of the plot and button from our plot module:</p>
<div class="figure">
<img src="https://github.com/emilyriederer/docs-submission/blob/master/shiny-modules/mod-demo.PNG?raw=true" alt="" />
<p class="caption">Line graph for flight arrival times where we see how many days exceeded the average</p>
</div>
<p>This may be overkill for a simple app, but composing modules is very useful as your application grows in complexity. Everything you bundle into a module gives you a license to forget about how the next layer lower is implemented and frees up your mind to take on the next challenge.</p>
</div>
<div id="putting-it-all-together" class="section level2">
<h2>Putting it all together</h2>
<p>Finally, we are ready to write our complete application in a file called <code>flights-app.R</code>:</p>
<pre class="r"><code>viz_monthly <- function(df, y_var, threshhold = NULL) {
ggplot(df) +
aes(
x = .data[["day"]],
y = .data[[y_var]]
) +
geom_line() +
geom_hline(yintercept = threshhold, color = "red", linetype = 2) +
scale_x_continuous(breaks = seq(1, 29, by = 7)) +
theme_minimal()
}
# text module ----
text_ui <- function(id) {
fluidRow(
textOutput(NS(id, "text"))
)
}
text_server <- function(id, df, vbl, threshhold) {
moduleServer(id, function(input, output, session) {
n <- reactive({sum(df()[[vbl]] > threshhold)})
output$text <- renderText({
paste("In this month",
vbl,
"exceeded the average daily threshhold of",
threshhold,
"a total of",
n(),
"days")
})
})
}
text_demo <- function() {
df <- data.frame(day = 1:30, arr_delay = 1:30)
ui <- fluidPage(text_ui("x"))
server <- function(input, output, session) {
text_server("x", reactive({df}), "arr_delay", 15)
}
shinyApp(ui, server)
}
# plot module ----
plot_ui <- function(id) {
fluidRow(
column(11, plotOutput(NS(id, "plot"))),
column( 1, downloadButton(NS(id, "dnld"), label = ""))
)
}
plot_server <- function(id, df, vbl, threshhold = NULL) {
moduleServer(id, function(input, output, session) {
plot <- reactive({viz_monthly(df(), vbl, threshhold)})
output$plot <- renderPlot({plot()})
output$dnld <- downloadHandler(
filename = function() {paste0(vbl, '.png')},
content = function(file) {ggsave(file, plot())}
)
})
}
plot_demo <- function() {
df <- data.frame(day = 1:30, arr_delay = 1:30)
ui <- fluidPage(plot_ui("x"))
server <- function(input, output, session) {
plot_server("x", reactive({df}), "arr_delay")
}
shinyApp(ui, server)
}
# metric module ----
metric_ui <- function(id) {
fluidRow(
text_ui(NS(id, "metric")),
plot_ui(NS(id, "metric"))
)
}
metric_server <- function(id, df, vbl, threshhold) {
moduleServer(id, function(input, output, session) {
text_server("metric", df, vbl, threshhold)
plot_server("metric", df, vbl, threshhold)
})
}
metric_demo <- function() {
df <- data.frame(day = 1:30, arr_delay = 1:30)
ui <- fluidPage(metric_ui("x"))
server <- function(input, output, session) {
metric_server("x", reactive({df}), "arr_delay", 15)
}
shinyApp(ui, server)
}</code></pre>
<pre class="r"><code># load libraries ----
library(nycflights13)
library(shiny)
library(ggplot2)
library(dplyr)
# data prep ----
ua_data <-
nycflights13::flights %>%
filter(carrier == "UA") %>%
mutate(ind_arr_delay = (arr_delay > 5)) %>%
group_by(year, month, day) %>%
summarize(
n = n(),
across(ends_with("delay"), mean, na.rm = TRUE)
) %>%
ungroup()
# full application ----
ui <- fluidPage(
titlePanel("Flight Delay Report"),
sidebarLayout(
sidebarPanel = sidebarPanel(
selectInput("month", "Month",
choices = setNames(1:12, month.abb),
selected = 1
)
),
mainPanel = mainPanel(
h2(textOutput("title")),
h3("Average Departure Delay"),
metric_ui("dep_delay"),
h3("Average Arrival Delay"),
metric_ui("arr_delay"),
h3("Proportion Flights with >5 Min Arrival Delay"),
metric_ui("ind_arr_delay")
)
)
)
server <- function(input, output, session) {
output$title <- renderText({paste(month.abb[as.integer(input$month)], "Report")})
df_month <- reactive({filter(ua_data, month == input$month)})
metric_server("dep_delay", df_month, vbl = "dep_delay", threshhold = 10)
metric_server("arr_delay", df_month, vbl = "arr_delay", threshhold = 10)
metric_server("ind_arr_delay", df_month, vbl = "ind_arr_delay", threshhold = 0.5)
}
shinyApp(ui, server)</code></pre>
<p>You can find all of the code for this tutorial in this <a href="https://github.com/emilyriederer/demo-shiny-modules">demo Shiny application</a> repository.</p>
<p>Notice how few lines of code this file requires to create all of our components and interactions! We’ve eliminated much of the dense code, nesting, and potential duplication we might have encountered if trying to write our application without modules. The top-level code is accessible, semantic, and declarative. It is easy to understand the intent of each line and which pieces of UI and server logic are responsible for which components.</p>
<p>Not all modules are made alike, and in this walk-through I chose simple tasks to demonstrate. Note that our modules <em>consume</em> a reactive variable (data) from the environment, but they do not attempt to <em>alter</em> the global environment or <em>exchange</em> information between them. Modules that simply consume reactives are the easiest way to start out.</p>
<p><em>Note from the Editor: Emily’s winning entry displays several characteristics of good technical writing. She is laser focused on her audience: R users who have some Shiny experience but who are not familiar with modules. Emily’s prose is direct, simple, informal and engaging. Reading it, I feel as if Emily is beside me showing me how things work, and that she cares about me understanding it. Emily’s code is spacious, and laid out to be read by others. And maybe not so obvious on the first reading, Emily’s writing is disciplined. It is clear that she knows a lot more about things than she has has put into the post, but is working under self imposed constraints in pursuit of clarity.</em></p>
</div>
<script>window.location.href='https://rviews.rstudio.com/2021/10/20/a-beginner-s-guide-to-shiny-modules/';</script>
FDA and the Dynamics of Curves
https://rviews.rstudio.com/2021/10/14/fda-and-the-dynamics-of-curves/
Thu, 14 Oct 2021 00:00:00 +0000https://rviews.rstudio.com/2021/10/14/fda-and-the-dynamics-of-curves/
<script src="/2021/10/14/fda-and-the-dynamics-of-curves/index_files/header-attrs/header-attrs.js"></script>
<p>An elegant application of Functional Data Analysis is to model longitudinal data as a curve and then study the curve’s dynamics. For example, in pharmacokinetics and other medical studies analyzing multiple measurements of drug or protein concentrations in blood samples, it may be interest to determine if the concentrations in subjects undergoing one type of treatment rise quicker than those undergoing an alternative treatment. In this post, I will generate some plausible fake data for measurements taken over time for two groups of subjects, use the techniques of Functional Data Analysis to represent these data as a continuous curve for each subject, and look at some of the dynamic properties of the curves, in particular their velocities and accelerations.</p>
<div id="synthetic-data" class="section level3">
<h3>Synthetic Data</h3>
<p>The <a href="https://cran.r-project.org/package=fdaoutlier">fdaoutlier</a> package contains functions to generate a number of stochastic models with a mechanism to generate reasonable outliers for each type of model. THe curves produced by model 4 look like they can serve plausible synthetic concentration curves. Instead of thinking of normal curves and outliers, I imagine the two related sets of curves to be the results of two different treatments influencing some measured concentration curve. In the example below, the curves associated with <strong>treatment 2</strong> are of the form: <span class="math display">\[X_i(t) = \mu t(1 - t)^m + e_i(t),\]</span>
while those associated with <strong>treatment 1</strong> are of the form:
<span class="math display">\[X_i(t) = \mu(1 - t)t^m + e_i(t)\]</span> where:</p>
<ul>
<li><span class="math inline">\(t\in [0,1]\)</span>,</li>
<li><span class="math inline">\(e_i(t)\)</span> is a Gaussian process with zero mean and covariance function of the form: <span class="math display">\[\gamma(s,t) = \alpha\exp\{-\beta|t-s|^\nu\},\]</span></li>
<li><span class="math inline">\(m\)</span> is a constant</li>
<li><span class="math inline">\(\mu\)</span> is the mean value</li>
<li><span class="math inline">\(\alpha\)</span>, <span class="math inline">\(\beta\)</span>, and <span class="math inline">\(\nu\)</span> are coefficients in the covariance function</li>
</ul>
<pre class="r"><code>library(fdaoutlier)
library(tidyverse)
library(fda)
library(gganimate)
library(gridExtra)</code></pre>
<p>The following code generates two different sets of longitudinal data from Model 4 which is described in the <a href="https://cran.r-project.org/web/packages/fdaoutlier/vignettes/simulation_models.html">vignette</a> to the <a href="https://cran.r-project.org/package=fdaoutlier">fdaoutlier</a> package.</p>
<pre class="r"><code>set.seed(95139)
n_curves <- 100
n_obs <- 50
mod4 <- simulation_model4(n = n_curves, p = n_obs, outlier_rate = .5, seed = 50, plot = FALSE)
index <- 1:n_curves
index1 <- mod4$true_outliers
# curves_mat is an n_curves x n_obs matrix
curves_mat <- mod4$data
treat <- rep(2,n_obs)
curves <- data.frame(index, treat, curves_mat)
curves <- curves %>% mutate(treat = if_else((index %in% index1),1,2))</code></pre>
<p>There are 50 curves for each treatment and 50 points for each curve. This is probably the simplest case possible, and it is good enough to show how to explore the dynamics of curves. However, if you work with real longitudinal data you know that things are rarely this simple. But please be assured that FDA can deal with considerably more complexity, including a variable number of measurements for each subject, different measurement times for each subject, and situations where you have far fewer than 50 points for each subject. I have explored some of these situations in previous posts. For example, look <a href="https://rviews.rstudio.com/2021/05/14/basic-fda-descriptive-statistics-with-r/">here</a> to see how to work with different time points, and <a href="https://rviews.rstudio.com/2021/07/08/exploratory-fda-with-sparse-data/">here</a> for some ideas for working with sparse data. The first link above also points to basic references that should help you to get started with your data.</p>
<p>Now, I reformat the data into a long form data frame and plot both sets of curves.</p>
<pre class="r"><code>time <- 1:n_obs
curves_l <- pivot_longer(curves, cols = !c("index", "treat"), names_to = "Xval") %>%
mutate(time = rep(time,100), .before = "treat", treat = as.factor(treat)) %>%
dplyr::select(-Xval)
p <- curves_l %>% ggplot(aes(time,value, color = treat)) +
geom_line(aes(group = index)) +
scale_color_manual(values=c("navy blue", "dark grey")) +
ggtitle("Model 4 Curves")
p</code></pre>
<p><img src="/2021/10/14/fda-and-the-dynamics-of-curves/index_files/figure-html/unnamed-chunk-3-1.png" width="672" /></p>
<p>So far we just have plots based on a relatively small number of data points. Nevertheless, our eyes extrapolate, and we imagine seeing two sets of continuous curves with one set clearly rising to its maximum value faster than the other set. But we really don’t have continuous curves yet, we just have points.</p>
<p>The next step is to invoke the mathematics of FDA to embed the points in an infinite dimensional vector space where the data for each subject is modeled by a continuous function (curve). Exactly how this happens is a bit involved, but the general idea is that we create a basis and then use the data and some techniques from the linear algebra of Hilbert spaces to estimate the time dependent coefficients that enable modeling each subject’s data points as a linear combination of the basis functions. So, from here on out we are not going to be working with the raw data anymore. We will be working with vector space models of the data. The upside is that we can now now have real curves (continuous function), and can calculate the values of the functions and other properties such as the first and second derivatives at any time point. If you are interested in the math, please have a look at the references listed at the bottom of my post on <a href="https://rviews.rstudio.com/2021/06/10/functional-pca-with-r/">Functional PCA</a>.</p>
</div>
<div id="modeling-the-data-as-functions-with-a-b-spline-basis" class="section level3">
<h3>Modeling the data as functions with a B-Spline Basis</h3>
<p>Here we use the function <code>fda::create.bspline.basis()</code> to create a B-Spline basis covering the interval of our observations. The plot of the curves above indicates that specifying a knot at every multiple of 5 ought to be adequate for representing our data. Note that using cubic splines <code>n_order</code> = 4 ensures that the splines will have continuous first and second derivatives at the knots.</p>
<pre class="r"><code>knots = c(seq(0,n_obs,5)) #Location of knots
n_knots = length(knots) #Number of knots
n_order = 4 # order of basis functions: for cubic b-splines: order = 3 + 1
n_basis = length(knots) + n_order - 2;
spline_basis = create.bspline.basis(rangeval = c(0,n_obs), nbasis = n_basis, norder = n_order)
#plot(spline_basis)</code></pre>
<p>The following code uses the function <code>fda::Data2fda()</code> and the <code>spline-basis</code> to convert the Model 4 data points into functions and produce one fda object for each of the two groups of treatments.</p>
<pre class="r"><code># df1 is an (n_curves/2) x (n_obs) matrix
df1 <- curves_mat[index1,] # data for treatment 1
index2 <- index[!(index %in% index1)]
df2 <- curves_mat[index2,] # data for treatment 2
# Use the b-spline basis to create represent the curves as vectors in the function space
df1_obj <- Data2fd(argvals = 1:n_obs, y = t(df1), basisobj = spline_basis, lambda = 0.5)
df2_obj <- Data2fd(argvals = 1:n_obs, y = t(df2), basisobj = spline_basis, lambda = 0.5)</code></pre>
</div>
<div id="computing-derivatives" class="section level3">
<h3>Computing Derivatives</h3>
<p>Here we evaluate each function along with its first and second derivatives at a finer time scale than we used to originally display our data.</p>
<pre class="r"><code>tfine <- seq(0,50,by=.5)
# Each matrix is 101 x 50 rows are different times, columns are curves
pos1 <- as.vector(eval.fd(tfine, df1_obj)); pos2 <- as.vector(eval.fd(tfine, df2_obj))
vel1 <- as.vector(eval.fd(tfine, df1_obj,1)); vel2 <- as.vector(eval.fd(tfine, df2_obj,1))
acc1 <- as.vector(eval.fd(tfine, df1_obj,2)); acc2 <- as.vector(eval.fd(tfine, df2_obj,2)) </code></pre>
<p>Note that the velocities and accelerations computed above were returned as matrices. We convert them to vectors and put them into a data frame for plotting.</p>
<pre class="r"><code>time <- rep(tfine,50)
id1 <- rep(1:50,each=101)
id2 <- rep(51:100,each=101)
derv1 <- data.frame(time, id1, pos1, vel1, acc1)
derv2 <- data.frame(time, id2, pos2, vel2, acc2)
pv1 <- derv1 %>% ggplot(aes(time,vel1,col=id1)) + geom_line(aes(group = id1)) + ggtitle("Velocity Treatment 1")
pv2 <- derv2 %>% ggplot(aes(time,vel2,col=id2)) + geom_line(aes(group = id2)) + ggtitle("Velocity Treatment 2")
pa1 <- derv1 %>% ggplot(aes(time,acc1,col=id1)) + geom_line(aes(group = id1)) +ggtitle("Acceleration Treatment 1")
pa2 <- derv2 %>% ggplot(aes(time,acc2,col=id2)) + geom_line(aes(group = id2)) + ggtitle("Acceleration Treatment 2")
grid.arrange(pv1, pa1, pv2, pa2, nrow = 2,ncol = 2, padding = unit(1, "line"))</code></pre>
<p><img src="/2021/10/14/fda-and-the-dynamics-of-curves/index_files/figure-html/unnamed-chunk-7-1.png" width="672" /></p>
<p>The velocities for treatment 1 head upwards before they decrease while the velocities for treatment 2 go straight down, and the curve up again. The accelerations for treatment 1 slope downward slightly while those of treatment two slope upward. So the plots indicate that the two sets of curves look like they behave differently.</p>
</div>
<div id="testing-for-differences" class="section level3">
<h3>Testing for Differences</h3>
<p>We can test for differences using the function <code>fda::tperm.fd()</code> which implements a resampling method to do pointwise t-tests. The functional data representing the curves for the two samples are combined in a single array and the labels for the curves are randomly shuffled. Recalculating the maximum value of the t-statistic for each point enables computing a null distribution. Then, at each time point, the observed data are compared with the 1 - <span class="math inline">\(\alpha\)</span> quantile of the null distribution.</p>
<p>The plot below shows the result of performing the t-test to compare the first derivatives of the two treatments. I use the function <code>fda.deriv.fd()</code> to calculate the first derivative for each treatment on the fly, just to show another way of doing things in the <code>fda</code> package. You can easily modify the code to compare accelerations.</p>
<pre class="r"><code>dfdt1 <- deriv.fd(df1_obj,1)
dfdt2 <- deriv.fd(df2_obj,1)
tres <- tperm.fd(dfdt1,dfdt2,plotres=FALSE)
max_q <- tres$qval
tres_dat <-tibble(time = tres$argvals, t_values = tres$Tvals,
q_vals = tres$qvals.pts)
p <- tres_dat %>% ggplot(aes(time,t_values, colour = "t_value")) + geom_line() +
geom_line(aes(time, q_vals, colour = "q_vals")) +
geom_line(aes(time, max_q,colour = "max_q"), linetype= "dashed") +
labs(x = "time", y = "") +
ggtitle("Statistics for Pointwise t-test")
p</code></pre>
<p><img src="/2021/10/14/fda-and-the-dynamics-of-curves/index_files/figure-html/unnamed-chunk-8-1.png" width="672" /></p>
<p>The blue curve shows the t-statistic for the observed values. The green curve represents the 95% quantiles, and the dashed red line is the 95% quantile of the maximum of null distribution t-statistics. The t-test confirms that the derivatives are indeed different except in the regions of overlap around time = 10 and time = 40.</p>
</div>
<div id="examine-phase-plots" class="section level3">
<h3>Examine Phase Plots</h3>
<p>Phase plots are useful for evaluating how the curves develop in the abstract <em>phase space</em> created by looking at position versus velocity, or velocity versus acceleration. Here we pick three curves from each treatment and plot velocity versus acceleration.</p>
<pre class="r"><code>phase1 <- derv1 %>% filter(id1 %in% 15:17)
phase2 <- derv2 %>% filter(id2 %in% 51:53)
pph1 <- phase1 %>% ggplot(aes(vel1,acc1,col=id1)) + geom_point() + ggtitle("Treat 1 v vs. acc")
pph2 <- phase2 %>% ggplot(aes(vel2,acc2,col=id2)) + geom_point() + ggtitle("Treat 2 v vs. acc")
grid.arrange(pph1, pph2, ncol = 2, padding = unit(1, "line"))</code></pre>
<p><img src="/2021/10/14/fda-and-the-dynamics-of-curves/index_files/figure-html/unnamed-chunk-9-1.png" width="672" />
Based on this small sample, it certainly appears that the curves associated with the two different treatments inhabit different regions of phase space.</p>
<p>Finally, it is easy and helpful to animate a phase diagram to show how a function develops in phase space over time. The animation below shows the first curve for treatment 1.</p>
<pre class="r"><code>pos <- eval.fd(tfine, df2_obj[1])
vel <- eval.fd(tfine, df2_obj[1],1)
acc <- eval.fd(tfine, df2_obj[1],2)
phase_dat <- tibble(tfine, vel, acc)
p <- ggplot(phase_dat, aes(vel,acc)) + geom_point() + ggtitle("Trajectory in Phase Space")
anim <- p + transition_time(tfine) + shadow_mark()
anim_save("anim.gif", anim)
#anim</code></pre>
<p><img src="anim.gif" /></p>
</div>
<script>window.location.href='https://rviews.rstudio.com/2021/10/14/fda-and-the-dynamics-of-curves/';</script>
August 2021: "Top 40" New CRAN Packages
https://rviews.rstudio.com/2021/09/27/august-2021-top-40-new-cran-packages/
Mon, 27 Sep 2021 00:00:00 +0000https://rviews.rstudio.com/2021/09/27/august-2021-top-40-new-cran-packages/
<p>One hundred sixty new packages covering a wide array of topics made it to CRAN in August. I thought I would emphasize the breadth of topics by expanding the number of categories organizing my “Top 40” selections beyond core categories that appear month after month. Here are my picks in fourteen categories: Archaeology, Computational Methods, Data, Education, Finance, Forestry, Genomics, Machine Learning, Medicine, Science, Statistics, Time Series, Utilities, and Visualization. Based on informal impressions formed over the last several months, I believe a new category combining applications in forestry, animal populations, climate change could become a regular core category.</p>
<h3 id="archaeology">Archaeology</h3>
<p><a href="https://cran.r-project.org/package=DIGSS">DIGSS</a> v1.0.2: Provides a simulation tool to estimate the rate of success that surveys including user-specific characteristics have in identifying archaeological sites given specific parameters of survey area, survey methods, and site properties. See <a href="https://www.cambridge.org/core/journals/american-antiquity/article/abs/effectiveness-of-subsurface-testing-a-simulation-approach/B667DE186230F25072CA7B2F002783A7">Kintigh (1988)</a> for background and the <a href="https://cran.r-project.org/web/packages/DIGSS/vignettes/DIGSS.html">vignette</a> for examples.</p>
<p><img src="DIGSS.png" height = "400" width="400" alt="Example of a field map with artifacts plotted"></p>
<h3 id="computational-methods">Computational Methods</h3>
<p><a href="https://cran.r-project.org/package=simlandr">simlandr</a> v0.1.1: Provides a set of tools for constructing potential landscapes for dynamical systems using Monte-Carlo simulation which is especially suitable for formal psychological models. There are vignettes on <a href="https://cran.r-project.org/web/packages/simlandr/vignettes/simulation.html">Dynamic Models and Simulations</a>, <a href="https://cran.r-project.org/web/packages/simlandr/vignettes/landscape.html">Constructing Potential Landscapes</a>, and <a href="https://cran.r-project.org/web/packages/simlandr/vignettes/barrier.html">Calculating the Lowest Elivation Path</a>.</p>
<p><img src="simlandr.png" height = "400" width="400" alt="Barrier Simulation Plot"></p>
<h3 id="data">Data</h3>
<p><a href="https://cran.r-project.org/package=metaboData">metaboData</a> v0.6.2: Provides access to remotely stored <a href="https://github.com/aberHRML/metaboData/releases">data sets</a> from a variety of biological sample matrices analyzed using mass spectrometry metabolomic analytical techniques. See the <a href="https://cran.r-project.org/web/packages/metaboData/vignettes/metaboData.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=metadat">metadat</a> v1.0-0: Contains a collection of data sets useful for teaching meta analysis. See <a href="https://cran.r-project.org/web/packages/metadat/readme/README.html">README</a> for more information.</p>
<p><a href="https://cran.r-project.org/package=nflreadr">nflreadr</a> v1.1.0: Provides functions for downloading data from the GitHub repository for the <a href="https://github.com/nflverse">nflverse project</a>. There is a brief <a href="https://cran.r-project.org/web/packages/nflreadr/vignettes/exporting_nflreadr.html">Introduction</a> and several short vignettes that serve as the data dictionary for the various files <a href="https://cran.r-project.org/web/packages/nflreadr/vignettes/dictionary_draft_picks.html">Draft Picks</a>, <a href="https://cran.r-project.org/web/packages/nflreadr/vignettes/dictionary_ff_rankings.html">Rankings</a>, etc.</p>
<p><a href="https://cran.r-project.org/package=OCSdata">OCSdata</a> v1.0.2: Provides functions to access and download data from the <a href="https://www.opencasestudies.org/">Open Case Studies</a> repositories on <a href="https://github.com/opencasestudies">GitHub</a>. See the <a href="https://cran.r-project.org/web/packages/OCSdata/vignettes/instructions.html">vignette</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=rATTAINS">rATTAINS</a> v0.1.2: Implements an interface to United States Environmental Protection Agency (EPA) <a href="https://www.epa.gov/waterdata/attains">ATTAINS</a> database used to track information provided by states about water quality assessments conducted under federal Clean Water Act requirements. There is a <a href="https://cran.r-project.org/web/packages/rATTAINS/vignettes/Introduction.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=taylor">taylor</a> v0.2.1: Provides access to a curated data set of Taylor Swift songs, including lyrics and audio characteristics. Data comes <a href="https://genius.com/artists/Taylor-swift">Genius</a> and the <a href="https://open.spotify.com/artist/06HL4z0CvFAxyc27GXpf02">Spotify</a> API. See <a href="https://cran.r-project.org/web/packages/taylor/readme/README.html">README</a> for examples,</p>
<p><img src="taylor.gif" height = "300" width="300" alt="Apple Music gif of Taylor Swify"></p>
<h3 id="education">Education</h3>
<p><a href="https://CRAN.R-project.org/package=karel">karel</a> v0.1.0: Provides an R implementation of Karel the robot, a programming language for teaching introductory concepts about general programming in an interactive and fun way, by writing programs to make Karel achieve tasks in the world she lives in. There are several vignettes including one on <a href="https://cran.r-project.org/web/packages/karel/vignettes/control_es_4.html">Control Structures</a> and another on <a href="https://cran.r-project.org/web/packages/karel/vignettes/descomp_es_3.html">Algorithmic Decomposition</a>.</p>
<p><img src="karel.gif" height = "300" width="500" alt="Gif of karel the robot moving along"></p>
<p><a href="https://cran.r-project.org/package=roger">roger</a> v0.99-0: Implements tools for grading the coding style and documentation of R scripts. This is the R component of <a href="https://gitlab.com/roger-project">Roger the Omni Grader</a>, an automated grading system for computer programming projects based on Unix shell scripts. Look <a href="https://roger-project.gitlab.io/">here</a> for more information.</p>
<h3 id="finance">Finance</h3>
<p><a href="https://cran.r-project.org/package=dispositionEffect">dispositionEffect</a> v1.0.0: Implements four different methodologies to evaluate the presence of the <a href="https://en.wikipedia.org/wiki/Disposition_effect">disposition effect</a> and other irrational investor behaviors based on investor transactions and financial market data. There is a <a href="https://cran.r-project.org/web/packages/dispositionEffect/vignettes/getting-started.html">Getting Started Guide</a>, and vignettes on <a href="https://cran.r-project.org/web/packages/dispositionEffect/vignettes/de-analysis.html">Analysis</a>, <a href="https://cran.r-project.org/web/packages/dispositionEffect/vignettes/de-parallel.html">Disposition Effects in Parallel</a>, and <a href="https://cran.r-project.org/web/packages/dispositionEffect/vignettes/de-timeseries.html">Time Series Disposition Effects</a>.</p>
<p><img src="dispositionEffect.png" height = "300" width="500" alt="Plot showing volatility and Disposition Effect"></p>
<p><a href="https://cran.r-project.org/package=HDShOP">HDShOP</a> v0.1.1: Provides functions to construct shrinkage estimators of high-dimensional mean-variance portfolios and performs high-dimensional tests on optimality of a given portfolio. See <a href="https://www.sciencedirect.com/science/article/abs/pii/S0377221717308494?via%3Dihub">Bodnar et al. (2018)</a>, <a href="https://ieeexplore.ieee.org/document/8767989">Bodnar et al. (2019)</a>, and <a href="https://ieeexplore.ieee.org/document/9258421">Bodnar et al. (2020)</a> for background.</p>
<p><a href="https://cran.r-project.org/package=tcsinvest">tcsinvest</a> v0.1.1: Implements an interface to the <a href="https://tinkoffcreditsystems.github.io/invest-openapi/">Tinkoff Investments API</a> which enables analysts and traders can interact with account and market data from within R. Clients for both REST and Streaming protocols have been implemented. There is a <a href="https://cran.r-project.org/web/packages/tcsinvest/vignettes/base.html">vignette</a>.</p>
<h3 id="forestry">Forestry</h3>
<p><a href="https://cran.r-project.org/package=APAtree">APAtree</a> v1.0.1: Provides functions to map the area potentially available (APA) using the approach from <a href="https://academic.oup.com/forestry/article/85/5/567/650068">Gspaltl et al. (2012)</a> and also aggregation functions to calculate stand characteristics based on APA-maps and the neighborhood diversity index as described in <a href="https://www.sciencedirect.com/science/article/pii/S1470160X2100738X?via%3Dihub">Glatthorn (2021)</a>. See the <a href="https://cran.r-project.org/web/packages/APAtree/vignettes/APAtree-vignette.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=efdm">efdm</a> v0.1.0: Implements the European Forestry Dynamics Model (<a href="https://ec.europa.eu/jrc/en/european-forestry-dynamics-model">EFDM</a>), a large-scale forest model that simulates the development of a forest and estimates volume of wood harvested for any given forested area. See <a href="https://op.europa.eu/en/publication-detail/-/publication/4715d130-0803-4e99-abed-915fec152c7b/language-en">Packalen et al. (2015)</a> for background and the <a href="https://cran.r-project.org/web/packages/efdm/vignettes/example.html">vignette</a> for examples.</p>
<h3 id="genomics">Genomics</h3>
<p><a href="https://cran.r-project.org/package=molnet">molnet</a> v0.1.0: Implements a network analysis pipeline that enables integrative analysis of multi-omics data including metabolomics. It allows for comparative conclusions between two different conditions, such as tumor subgroups, healthy vs. disease, or generally control vs. perturbed. The case study presented in the <a href="https://cran.r-project.org/web/packages/molnet/vignettes/Molnet_Vignette.html">vignette</a> uses data published by <a href="https://www.cell.com/cell/fulltext/S0092-8674(20)31400-8?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS0092867420314008%3Fshowall%3Dtrue">Krug (2020)</a>.</p>
<p><img src="molnet.png" height = "300" width="500" alt="Illustration of network analysis pipeline"></p>
<p><a href="https://cran.r-project.org/package=simtrait">simtrait</a> v1.0.21P Provides functions to simulate complex traits given a SNP genotype matrix and model parameters with an emphasis on avoiding common biases due to the use of estimated allele frequencies. Traits can follow three models: random coefficients, fixed effect sizes, and multivariate normal. GWAS method benchmarking functions as described in <a href="https://www.biorxiv.org/content/10.1101/858399v1">Yao and Ochoa (2019)</a> are also provided. See the <a href="https://cran.r-project.org/web/packages/simtrait/vignettes/simtrait.html">vignette</a>.</p>
<p><img src="simtrait.png" height = "300" width="500" alt="Plot showing agreement of theoretical and RC kinship covariance matrices"></p>
<p><a href="https://cran.r-project.org/package=statgenIBD">statgenIBD</a> v1.0.1: Provides functions to calculate biparental, three and four-way crosses Identity by Descent (<a href="https://en.wikipedia.org/wiki/Identity_by_descent">IBD</a>) probabilities using Hidden Markov Models and inheritance vectors following <a href="https://www.jstor.org/stable/29713">Lander & Green (1987)</a> and <a href="https://www.pnas.org/content/108/11/4488">Huang (2011)</a>. See the <a href="https://cran.r-project.org/web/packages/statgenIBD/vignettes/IBDCalculations.html">vignette</a> for examples.</p>
<p><img src="statgenIBD.png" height = "300" width="500" alt="Plot of IBD probabilities"></p>
<h3 id="machine-learning">Machine Learning</h3>
<p><a href="https://cran.r-project.org/package=text2map">text2map</a> v0.1.0: Provides functions for computational text analysis for the social sciences including functions for working with word embeddings, text networks, and document-term matrices. For background on the methods used see <a href="https://link.springer.com/article/10.1007%2Fs42001-019-00048-6">Stoltz and Taylor (2019)</a>, <a href="https://link.springer.com/article/10.1007%2Fs42001-020-00075-8">Taylor and Stoltz (2020)</a>, <a href="https://sociologicalscience.com/articles-v7-23-544/">Taylor and Stoltz (2020)</a>, and <a href="https://www.sciencedirect.com/science/article/abs/pii/S0304422X21000504?via%3Dihub">Stoltz and Taylor (2021)</a>. There is a <a href="https://cran.r-project.org/web/packages/text2map/vignettes/CMDist-concept-movers-distance.html">Quick Start Guide</a> and a vignette on <a href="https://cran.r-project.org/web/packages/text2map/vignettes/concept-class-analysis.html">Concept Class Analysis</a>.</p>
<p><img src="text2map.png" height = "300" width="500" alt="Plot illustrating closeness of concepts"></p>
<p><a href="https://cran.r-project.org/package=NPRED">NPRED</a> v1.0.5: Uses partial informational correlation (PIC) to identify the meaningful predictors from a large set of potential predictors. Details can be found in <a href="https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2013WR013845">Sharma & Mehrotra, (2014)</a>, <a href="https://www.sciencedirect.com/science/article/abs/pii/S1364815216301578?via%3Dihub">Sharma et al.(2016)</a>, and <a href="https://www.sciencedirect.com/science/article/abs/pii/S0309170805002137?via%3Dihub">Mehrotra & Sharma (2006)</a>. See the <a href="https://cran.r-project.org/web/packages/NPRED/vignettes/NPRED.html">vignette</a> for examples.</p>
<p><img src="NPRED.png" height = "300" width="500" alt="Illustration of using partial weights"></p>
<p><a href="https://cran.r-project.org/package=stabiliser">stabiliser</a> v0.1.0: Implements an approach to variable selection through stability selection and the use of an objective threshold based on permuted data. See <a href="https://www.nature.com/articles/s41598-020-79317-8">Lima et al (2021)</a> and <a href="https://rss.onlinelibrary.wiley.com/doi/10.1111/j.1467-9868.2010.00740.x">Meinshausen & Buhlmann (2010)</a> for details and the <a href="https://cran.r-project.org/web/packages/stabiliser/vignettes/stabiliser.html">vignette</a> for an example.</p>
<p><img src="stabiliser.png" height = "500" width="300" alt="Plot measuring stability of variables"></p>
<h3 id="medicine">Medicine</h3>
<p><a href="https://cran.r-project.org/package=dreamer">dreamer</a> v3.0.0: Fits longitudinal dose-response models utilizing a Bayesian model averaging approach as outlined in <a href="https://onlinelibrary.wiley.com/doi/10.1002/bimj">Gould (2019)</a> for both continuous and binary responses. See the <a href="https://cran.r-project.org/web/packages/dreamer/vignettes/dreamer.html">vignette</a>.</p>
<p><img src="dreamer.png" height = "300" width="500" alt="Plot from dreamer package"></p>
<p><a href="https://cran.r-project.org/package=smartDesign">smartDesign</a> v0.72: Implements the SMART trial design, as described by <a href="https://www.tandfonline.com/doi/abs/10.1080/19466315.2021.1883472?journalCode=usbr20">He et al. (2021)</a> which includes multiple stages of randomization where participants are randomized to an initial treatment in the first stage and then subsequently re-randomized between treatments in the following stage. There is a <a href="https://cran.r-project.org/web/packages/smartDesign/vignettes/DTR.html">Dynamic Treatment Tutorial</a> and a <a href="https://cran.r-project.org/web/packages/smartDesign/vignettes/SST.html">Sequential Design Tutorial</a>.</p>
<h3 id="science">Science</h3>
<p><a href="https://cran.r-project.org/package=bootf2">bootf2</a> v0.4.1: Provides functions to compare dissolution profiles with confidence intervals of the <a href="https://cran.r-project.org/web/packages/bootf2/vignettes/bootf2.html">similarity factor f2</a> and also functions to simulate dissolution profiles. There are multiple vignettes including and <a href="https://cran.r-project.org/web/packages/bootf2/vignettes/introduction.html">Introduction</a> a <a href="https://cran.r-project.org/web/packages/bootf2/vignettes/sim.dp.html">Simulation Example</a>.</p>
<p><img src="bootf2.png" height = "300" width="500" alt="Plot of dissolution profiles."></p>
<p><a href="https://cran.r-project.org/package=track2KBA">track2KBA</a> v1.0.1: Provides functions to prepare and analyze animal tracking data in order to identify areas of potential interest for population level conservation. See <a href="https://onlinelibrary.wiley.com/doi/10.1111/ddi.12411">Lascelles et al. (2016)</a> for background on the methodology employed and the <a href="https://cran.r-project.org/web/packages/track2KBA/vignettes/track2kba_workflow.html">vignette</a> for examples and workflow.</p>
<p><img src="track2KBA.png" height = "400" width="300" alt="Plot shows estimated minimum number of birds in space around breeding island."></p>
<h3 id="statistics">Statistics</h3>
<p><a href="https://cran.r-project.org/package=chyper">chyper</a> v0.3.1: Provides functions to work with the conditional hypergeometric distribution. See the <a href="https://cran.r-project.org/web/packages/chyper/vignettes/Guide.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=sprtt">sprtt</a> v0.1.0: Provides functions to perform sequential t-tests including those of <a href="https://academic.oup.com/sf/article-abstract/27/2/170/1991955">Wald (1947)</a>, <a href="https://www.jstor.org/stable/2332385?origin=crossref">Rushton (1950)</a>, <a href="https://www.jstor.org/stable/2334026?origin=crossref">Rushton (1952)</a>, and <a href="https://www.jstor.org/stable/2333131?origin=crossref">Hajnal (1961)</a>. There is an <a href="https://cran.r-project.org/web/packages/sprtt/vignettes/usage-sprtt.html">Introduction</a> to the package, a <a href="https://cran.r-project.org/web/packages/sprtt/vignettes/use-case.html">Use Case</a>, and a vignette on the <a href="https://cran.r-project.org/web/packages/sprtt/vignettes/sequential_testing.html">Sequential t-test</a>.</p>
<p><a href="https://cran.r-project.org/package=SurvMetrics">SurvMetrics</a> v0.3.5: Implements popular evaluation metrics commonly used in survival prediction including Concordance Index, Brier Score, Integrated Brier Score, Integrated Square Error, Integrated Absolute Error and Mean Absolute Error. For detailed information, see <a href="https://projecteuclid.org/journals/annals-of-applied-statistics/volume-2/issue-3/Random-survival-forests/10.1214/08-AOAS169.full">Ishwaran et al. (2008)</a> and <a href="https://link.springer.com/article/10.1007%2Fs10985-016-9372-1">Moradian et al. (2017)</a>. The <a href="https://cran.r-project.org/web/packages/SurvMetrics/vignettes/SurvMetrics-vignette.html">vignette</a> offers examples.</p>
<p><img src="SurvMetrics.png" height = "400" width="300" alt="Boxplot comparing models"></p>
<h3 id="time-series">Time Series</h3>
<p><a href="https://cran.r-project.org/package=DCSmooth">DCSmooth</a> v1.0.2: Implements nonparametric smoothing techniques for data on a lattice or functional time series which allow for modeling a dependency structure of the error terms of the nonparametric regression model. See <a href="https://www.tandfonline.com/doi/abs/10.1198/106186002420">Beran & Feng (2002)</a>, <a href="https://www.jstor.org/stable/2533197?origin=crossref">Mueller & Wang (1994)</a>, <a href="https://ideas.repec.org/p/pdn/ciepap/144.html">Feng & Schaefer (2021)</a>, and <a href="https://ideas.repec.org/p/pdn/ciepap/143.html">Schaefer & Feng (2021)</a> for the background and the <a href="https://cran.r-project.org/web/packages/DCSmooth/vignettes/DCSmooth.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=STFTS">STFTS</a> v0.1.0: Implements statistical hypothesis tests of functional time series including a functional stationarity test, a functional trend stationarity test and a functional unit root test.</p>
<p><a href="https://cran.r-project.org/package=WASP">WASP</a> v1.4.1: Implements wavelet-based variance transformation methods for system modeling and prediction. For details see <a href="https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2019WR026962">Jiang et al. (2020)</a>, <a href="https://www.sciencedirect.com/science/article/abs/pii/S1364815220309646?via%3Dihub">Jiang et al. (2020)</a>, and <a href="https://www.sciencedirect.com/science/article/abs/pii/S0022169421008660?via%3Dihub">Jiag et al. (2021)</a> There is a <a href="https://cran.r-project.org/web/packages/WASP/vignettes/WASP.html">vignette</a> with examples.</p>
<p><img src="WASP.png" height = "300" width="500" alt="Plot showing Daubechies wavelets"></p>
<h3 id="utilities">Utilities</h3>
<p><a href="https://cran.r-project.org/package=ExpImage">ExpImage</a> v0.2.0: Provides an image editing tool for researchers which includes functions for segmentation and for obtaining biometric measurements. There are several vignettes including: <a href="https://cran.r-project.org/web/packages/ExpImage/vignettes/Contagem_de_bovinos.html">Contagem de bovinos</a>, <a href="https://cran.r-project.org/web/packages/ExpImage/vignettes/Contagem_de_objetos.html">Contagem de objetos</a>, and <a href="https://cran.r-project.org/web/packages/ExpImage/vignettes/Edicao_de_imagens.html">Como editar imagens</a>.</p>
<p><img src="ExpImage.png" height = "300" width="300" alt="Image of leaf with seeds to be counted"></p>
<p><a href="https://cran.r-project.org/package=meltr">meltr</a> v1.0.0: Provides functions to read non-rectangular data, such as ragged forms of csv (comma-separated values), tsv (tab-separated values), and fwf (fixed-width format) files. See <a href="https://cran.r-project.org/web/packages/meltr/readme/README.html">README</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=plumbertableau">plumbertableau</a> v0.1.0: Implements tools for building <code>plumber</code> APIs that can be used in <a href="https://www.tableau.com/">Tableau</a> workbooks. There is a package <a href="https://cran.r-project.org/web/packages/plumbertableau/vignettes/introduction.html">Introduction</a> and vignettes on <a href="https://cran.r-project.org/web/packages/plumbertableau/vignettes/r-developer-guide.html">Writing Extensions</a>, <a href="https://cran.r-project.org/web/packages/plumbertableau/vignettes/tableau-developer-guide.html">Using Extensions in Tableau</a>, and <a href="https://cran.r-project.org/web/packages/plumbertableau/vignettes/publishing-extensions.html">Publishing Extensions to RStudio Connect</a>.</p>
<p><a href="https://cran.r-project.org/package=string2path">string2path</a> v0.0.2: Provides functions to extract glyph information from a font file, translate the outline curves to flattened paths or tessellated polygons, and return the results as a <code>data.frame</code>. See <a href="https://cran.r-project.org/web/packages/string2path/readme/README.html">README</a> for an example.</p>
<p><img src="string2path.png" height = "300" width="500" alt="Japanese kana and kanji as glyphs on an x-y grid"></p>
<p><a href="https://cran.r-project.org/package=trackdown">trackdown</a> v1.0.0: Uses <a href="https://www.google.com/drive/">Googel Drive</a> to implement tools for collaborative writing and editing of R Markdown and Sweave documents. There are some <a href="https://cran.r-project.org/web/packages/trackdown/vignettes/trackdown-tech-notes.html">Tech Notes</a> and vignettes on <a href="https://cran.r-project.org/web/packages/trackdown/vignettes/trackdown-features.html">Features</a> and <a href="https://cran.r-project.org/web/packages/trackdown/vignettes/trackdown-workflow.html">Workflow</a>.</p>
<h3 id="visualization">Visualization</h3>
<p><a href="https://cran.r-project.org/package=aRtsy">aRtsy</a> v0.1.1: Provides algorithms for creating artwork in the <code>ggplot2</code> language that incorporate some form of randomness. See <a href="https://cran.r-project.org/web/packages/aRtsy/readme/README.html">README</a> for examples and package use.</p>
<p><img src="aRtsy.png" height = "200" width="400" alt="aRtsy generated abstract art"></p>
<p><a href="https://cran.r-project.org/package=ggcleveland">ggcleveland</a> v0.1.0: Provides functions to produce <code>ggplot2</code> versions of the visualization tools described in William Cleveland’s book <a href="https://www.amazon.com/Visualizing-Data-William-S-Cleveland/dp/0963488406/ref=sr_1_3?dchild=1&keywords=Visualizing+Data+cleveland&qid=1632504146&sr=8-3"><em>Visualizing Data</em></a>. The <a href="https://cran.r-project.org/web/packages/ggcleveland/vignettes/ggplot-cleveland.html">vignette</a> contains several examples.</p>
<p><img src="ggcleveland.png" height = "200" width="400" alt="William Cleveland inspired qqplots"></p>
<p><a href="https://cran.r-project.org/package=ggtikz">ggtikz</a> v0.0.1: Provides tools to annotate <code>ggplot2</code> plots with <a href="https://www.overleaf.com/learn/latex/TikZ_package">TikZ</a> code using absolute data or relative coordinates. See the <a href="https://cran.r-project.org/web/packages/ggtikz/vignettes/examples.pdf">vignette</a>.</p>
<p><img src="ggtikz.png" height = "300" width="300" alt="Scatter plot annotated with text and lines"></p>
<p><a href="https://cran.r-project.org/package=tidycharts">tidycharts</a> v0.1.2: Provides functions to generate charts compliant with the International Business Communication Standards (<a href="https://www.ibcs.com/">IBCS</a>) including unified bar widths, colors, chart sizes, etc. There is a <a href="https://cran.r-project.org/web/packages/tidycharts/vignettes/Getting_Started.html">Getting Started</a> guide and vignettes on <a href="https://cran.r-project.org/web/packages/tidycharts/vignettes/EDA-for-palmer-penguins-data-set.html">EDA</a>, <a href="https://cran.r-project.org/web/packages/tidycharts/vignettes/customize-package.html">Customization</a>, and <a href="https://cran.r-project.org/web/packages/tidycharts/vignettes/join_charts.html">Joining Charts</a>.</p>
<p><img src="tidycharts.png" height = "300" width="500" alt="tidycharts IBCS compliant histogram"></p>
<script>window.location.href='https://rviews.rstudio.com/2021/09/27/august-2021-top-40-new-cran-packages/';</script>
A Guide to Binge Watching R / Medicine 2021
https://rviews.rstudio.com/2021/09/09/a-guide-to-binge-watching-r-medicine/
Thu, 09 Sep 2021 00:00:00 +0000https://rviews.rstudio.com/2021/09/09/a-guide-to-binge-watching-r-medicine/
<p><a href="https://r-medicine.org/">R / Medicine</a> is a big deal. This year, the conference grew by 13% with 665 people from over 60 countries signing up for the virtual event which was held last month. 34% percent of the registrants were from outside of the United States and 17% identified as physicians.</p>
<p><img src="rmed.png" height = "300" width="500" alt="Global map with locations of R Medicine registrants indicated"></p>
<p>The conference is now an established international event where experts report on the advanced use of the R language, Machine Learning, and statistical analysis, and discuss the successes and challenges associated with bringing these technologies to day-to-day medical practice.</p>
<p>Almost all of the talks, including keynotes, regular talks, lightning talks, pre-conference workshops and poster sessions are available online. <a href="https://r-medicine.org/schedule/">Find the links</a> on the R / Medicine site or look through the <a href="https://www.youtube.com/playlist?list=PL4IzsxWztPdmHxCpS_c2l_jbMfrywWciZ">playlist </a> on the <a href="https://www.r-consortium.org/">R Consortium Youtube</a> Channel. Note that the posters can be viewed by going to the <a href="https://spatial.chat/s/R-Medicine2021?room=231308">conference spatial.chat site</a>. (If you and a friend visit at the same time you should be able to “walk around” the posters and chat about what you see.)</p>
<p>To kick off an evening of binge watching the conference I would begin with the keynotes.</p>
<h3 id="the-keynotes">The Keynotes</h3>
<p><a href="https://medicine.umich.edu/dept/lhs/karandeep-singh-md-mmsc">Dr. Karandeep Singh</a> sets the hook for his talk, <a href="https://www.youtube.com/watch?v=l71wLKUr26E&list=PL4IzsxWztPdmHxCpS_c2l_jbMfrywWciZ&index=7">Bringing Machine Learning Models to the Bedside at Scale</a>, two minutes into the video when he asks:</p>
<blockquote>
<p>Who are the twenty sickest patients in the hospital right now who are not in the ICU?</p>
</blockquote>
<p>This straightforward question immediately gets to the promise and the problems of introducing large scale machine learning algorithms into the hospital, and indicates how medical practice interacts with big money questions about allocating resources. Both physicians and administrators would like to identify high risk patients and treat them proactively while being able to confidently spend less on unnecessary test for low risk patients. About (5:10) into the talk, Karandeep begins discussing the challenges associated with introducing machine learning models.</p>
<p><img src="chal.png" height = "300" width="500" alt="Slide with list of challenges discussed. Is there infrastructure to support models? Should we implement a model? Once implemented, how do we measure model performance? Is a model “good enough” to use? Do users agree on how to use the model? Is the model effective when used? What does governance look like for machine learning models?"></p>
<p>In the remainder of the talk he describes the technical infrastructure and then the governance or “social infrastructure” needed for success.</p>
<p>If you enjoy a good detective story, and take pride in your ability to interpret a well-done statistical plot you are certainly going to want to watch <a href="http://ziadobermeyer.com/">Ziad Obermeyer’s</a> keynote <a href="https://www.youtube.com/watch?v=JfKYO1W4uuA&list=PL4IzsxWztPdmHxCpS_c2l_jbMfrywWciZ&index=27">Dissecting Algorithmic Bias</a>. About two minutes into the video Professor Obermeyer sets the stage with the warning:</p>
<blockquote>
<p>The single greatest threat to all of the gains that we can make in using algorithms in medicine is letting them go wrong in increasingly well known ways.</p>
</blockquote>
<p>and the observation that due to the focus of the US health care management on “high risk care management” an estimated 150 to 200 million Americans are sorted by algorithms every year. He goes on to work through a case study that illustrates how an algorithm built with good intentions had the effect of scaling up racial bias.</p>
<p><img src="bias.png" height = "300" width="600" alt="Dot plot with regression line of algorithm risk score versus realized cost to show the racial bias in high risk care management"></p>
<p>A second case study features an algorithm that “fights against” racial bias. Along the way, Ziad weaves two common themes into his presentation:</p>
<ol>
<li>So many of the ways that algorithms can go wrong come from training algorithms with the wrong target variables, often “convenient and tempting proxies”.</li>
<li>The necessity of follow-up work to fix underlying problems.</li>
</ol>
<p>In the remainder of this post, I have organized the talks into six categories that you may find helpful for setting your viewing program: Clinical Practice, Clinical Trials, Medical Data, R in Production, R Tools, and Short Courses. The majority of the talks have a machine learning angle. There is quite a bit of Shiny and several R packages, not all of them on CRAN, are featured. I have provided links when I could find them. I don’t want to spoil anyone’s fun in searching through the videos for “Easter Eggs”, but the <em>Reproducible Research with R</em> short course contains the first preview on the <a href="https://quarto.org/">Quarto</a> Publishing system in a talk from anyone at RStudio. (Note that the video needs some editing. Start watching at 9 minutes.)</p>
<h3 id="clinical-practice">Clinical Practice</h3>
<ul>
<li>Building an Interpretable ML Model API for Interpretation of CNVs in Patients with Rare Diseases - Francisco Requena</li>
<li>Subgroup Identification and Precision Medicine with the personalized R Package - Jared Huling</li>
<li>R and Shiny Dashboards to Facilitate Quality Improvement in Anesthesiology and Periopeartive Care - Robert Lobato</li>
<li><code>tidytof</code>: Predicting Patient Outcomes from Single-cell Data using Tidy Data Principles - Timothy Keyes</li>
<li>Assessing ML Model Performance in DIverse Populations and Across Time - Victor Castro, Roy Perlis</li>
</ul>
<h3 id="clinical-trials">Clinical Trials</h3>
<ul>
<li>Designing Early Phase Clinical Trials with <a href="https://github.com/zabore/ppseq"><code>ppseq</code></a> - Emily Zabor</li>
<li>Collaborative, Reproducible Exploration of Clinical Trial Data - Michael Kane</li>
<li>Graphical Displays in R for Clinical Trials - Steven Schwager</li>
<li><a href="https://www.gitmemory.com/presagia-analytics/ctrialsgov"><code>ctrialsgov</code></a>: Access, Visualization, and Discovery of the ClinicalTrials.gov Database - Taylor Arnold</li>
</ul>
<h3 id="medical-data">Medical Data</h3>
<ul>
<li>Scaling Up and Deploying Shiny and Text Mining for National Health Decisions - Andreas Soteriade, Chris Beeley</li>
<li>Mapping African Health Data with <a href="https://afrimapr.github.io/afrimapr.website/"><code>afrimapr</code></a> Package, Training & Community - Andy South</li>
<li>You R What You Measure: Digital Biomarkers for Insights in Personalized Health - Irene van den Broek</li>
<li>Shiny and REDCap for a Global Research Consortium - Judith Lewis, Stephany Duda</li>
<li>Diving into Registry Data: Using R for Large Norwegian Health Registries - Julia Romanowska</li>
<li><a href="https://cran.r-project.org/web/packages/ReviewR/index.html"><code>ReviewR</code></a>: A Shiny App for Reviewing Clinical Records - Laura Wiley, David Mayer</li>
<li><a href="https://cran.r-project.org/package=DOPE"><code>DOPE</code></a>: An R package for Processing and Classifying Drug Names - Layla Bouzoubaa</li>
<li><a href="https://cran.r-project.org/package=medicaldata"><code>medicaldata</code></a> for Teaching #Rstats - Peter Higgins</li>
<li>Stem Cell Transplant Outcomes Reporting using R/Shiny - Richard Hanna, Stephan Kadauke</li>
</ul>
<h3 id="r-in-production">R in Production</h3>
<ul>
<li>Second Server to the Right and Straight On ‘til Production: Deploying a GxP Shiny Application - Marcus Adams</li>
<li>Target Markdown and <a href="https://docs.ropensci.org/stantargets/"><code>stantargets</code></a> for Bayesian model validation pipelines - Will Landau</li>
<li><a href="https://www.themillerlab.io/publication/genetex/"><code>GENETEX</code></a>: A Genomics Report Text Mining R Package to Capture Real-world Clinico-genomic Data - David Miller, Sophia Shalhout</li>
</ul>
<h3 id="r-tools">R Tools</h3>
<ul>
<li>Generalized Additive Models for Longitudinal Biomedical Data - Ariel Mundo<br /></li>
<li>Multistate Data Using the <a href="https://cran.r-project.org/package=survival"><code>survival</code></a> Package - Beth Atkinson<br /></li>
<li>Bayesian Random-Effects Meta-analysis using <a href="https://cran.r-project.org/package=survival"><code>bayesmeta</code></a> - Christian Rover<br /></li>
<li>An <a href="https://cran.r-project.org/package=arsenal"><code>arsenal</code></a> of R Functions for Statistical Summaries - Ethan Heinzen, Beth Atkinson, Jason Sinnwell</li>
<li>R Markdown and <a href="https://cran.r-project.org/package=officedown"><code>officedown</code></a> to Automate Clinical Trial Reporting - Damian Rodziewicz</li>
<li>Creating and Styling PPTX Slides with <a href="https://cran.r-project.org/package=rmarkdown"><code>rmarkdown</code></a> - Emil Hvitfeldt</li>
<li><a href="https://github.com/ML4LHS/runway"><code>runway</code></a>: an R Package to Visualize Prediction Model Performance - Jie Cao, Karandeep Singh</li>
<li><a href="https://CRAN.R-project.org/package=clinspacy"><code>clinspacy</code></a>: An R package for Clinical Natural Language Processing - Jie Cao, Karandeep Singh</li>
<li>Data Visualization for Machine Learning Practitioners - Julie Silge</li>
<li>Animated Data Visualizations with <a href="https://CRAN.R-project.org/package=gganimate"><code>gganimate</code></a> for Science Communication during the Pandemic - Kristen Panthagani</li>
<li>Incorporating Risk-of-Bias Assessments into Evidence Syntheses with <a href="https://cran.r-project.org/package=robvis"><code>robvis</code></a> - Luke McGuinness, Randall Boyes, Alex Fowler</li>
<li>‘gpmodels’: A Grammar of Prediction Models - Sean Meyer, Karandeep Singh</li>
<li>CONSORT Diagrams in R with <a href="https://github.com/tgerke/ggconsort"><code>ggconsort</code></a> - Travis Gerke<br /></li>
</ul>
<h3 id="short-courses">Short Courses</h3>
<ul>
<li>Secure Medical Data Collection: Best Practices with Excel, and Leveling Up to REDCap and <a href="https://github.com/kamclean/collaborator"><code>CollaboratoR</code></a> - Peter Higgins, Will Beasley, Kenneth MacLean, Amanda Miller</li>
<li>Introduction to R for Medical Data - Ted Laderas, Daniel Chen, Mara Alexeev</li>
<li>An Introductory R Guide for Targeted Maximum Likelihood Estimation in Medical Research - Ehsan Karim, Hanna Frank</li>
<li>Mapping Spatial Health Data - Marynia Kolak, Susan Paykin</li>
<li>From SAS to R - Joe Krsszun<br /></li>
<li>Reproducible Research with R - Alison Hill, Stephan Kaduke, Paul Villanueva</li>
</ul>
<script>window.location.href='https://rviews.rstudio.com/2021/09/09/a-guide-to-binge-watching-r-medicine/';</script>
July 2021: "Top 40" New CRAN Packages
https://rviews.rstudio.com/2021/08/26/july-2021-top-40-new-cran-packages/
Thu, 26 Aug 2021 00:00:00 +0000https://rviews.rstudio.com/2021/08/26/july-2021-top-40-new-cran-packages/
<p>One hundred eighty-three new packages stuck to CRAN in July. Here are my “Top 40” picks in eleven categories: Data, Ecology, Finance, Genomics, Machine Learning, Medicine, Science, Statistics, Time Series, Utilities, and Visualization. Although I don’t have any formal specification for these categories, I do my best to main my subjective sense of consistency from month to month. Nevertheless, watching the monthly ebb and flow of the number of packages that fit into the various categories is interesting. This month, developers seemed to be focused on utilities. I classified forty-five packages as utilities this month.</p>
<h3 id="data">Data</h3>
<p><a href="https://cran.r-project.org/package=beans">beans</a> v0.1.0: Contains data on 13,611 beans from <a href="https://www.sciencedirect.com/science/article/abs/pii/S0168169919311573?via%3Dihub">Koklu and Ozkan (2020)</a>. The beans have been quantified using 16 morphologic image features and labeled with one of 6 values.</p>
<p><a href="https://CRAN.R-project.org/package=geckor">geckor</a> v0.1.1: Provides functions to collect current and historical cryptocurrency market data using the public <a href="https://www.coingecko.com/en/api">CoinGecko API</a>. There is a brief <a href="https://cran.r-project.org/web/packages/geckor/vignettes/supported-currencies-and-exchanges.html">overview</a> and vignettes on <a href="https://cran.r-project.org/web/packages/geckor/vignettes/current-data.html">Current</a> and <a href="https://cran.r-project.org/web/packages/geckor/vignettes/historical-data.html">Historical</a> market data.</p>
<p><a href="https://cran.r-project.org/package=ISLR2">ISLR2</a> v1.0: Contains the data sets used in the book <a href="https://www.statlearning.com/"><em>An Introduction to Statistical Learning with Applications in R, Second Edition</em></a>.</p>
<p><a href="https://cran.r-project.org/package=sageR">sageR</a> v0.3.0: Provides the data sets used in the book <em>Statistiques pour l’économie et la gestion, Théorie et applications en entreprise</em>. Look <a href="https://fbertran.github.io/sageR/">here</a> for descriptions of the data with code and plots.</p>
<p><img src="sageR.png" height = "500" width="500"></p>
<h3 id="ecology">Ecology</h3>
<p><a href="https://cran.r-project.org/package=DA">DA</a> v1.2.0: Provides functions for Discriminant Analysis (DA) for evolutionary inference, especially population genetic structure and community structure inference as described in <a href="https://www.authorea.com/users/304610/articles/460985-da-ecological-and-evolutionary-inference-using-supervised-discriminant-analysis?commit=668bd97318a7646fd432e4824228415ed209b692">Qin et al. (2020)</a>. See the <a href="https://cran.r-project.org/web/packages/DA/vignettes/DA.html">Introduction</a>.</p>
<p><img src="DA.png" height = "300" width="500"></p>
<p><a href="https://cran.r-project.org/package=Ostats">Ostats</a> v0.1.0: Provides functions to calculate O-statistics, or overlap statistics, which measure the degree of community-level trait overlap. See <a href="https://onlinelibrary.wiley.com/doi/10.1111/ecog.03641">Read et al. (2018)</a> for background. There is an <a href="https://cran.r-project.org/web/packages/Ostats/vignettes/Ostats-introduction.html">Introduction</a> and a vignette on <a href="https://cran.r-project.org/web/packages/Ostats/vignettes/Ostats-multivariate.html">Multivariate Ostats</a>.</p>
<p><img src="Ostats.png" height = "400" width="400"></p>
<h3 id="finance">Finance</h3>
<p><a href="https://cran.r-project.org/package=ffp">ffp</a> v0.1.0: Implements numerical entropy-pooling for scenario analysis as described in <a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1696802">Meucci (2010)</a> See the <a href="https://cran.r-project.org/web/packages/ffp/vignettes/Replicating-Meucci-Paper.html">vignette</a>.</p>
<p><img src="ffp.png" height = "300" width="500"></p>
<h3 id="genomics">Genomics</h3>
<p><a href="https://cran.r-project.org/package=utr.annotation">utr.annotation</a> v1.0.4: Implements a fast tool for annotating potential deleterious variants in the untranslated regions for both human and mouse species. See <a href="https://www.biorxiv.org/content/10.1101/2021.06.23.449510v2">Liu & Dougherty (2021)</a> for background and the <a href="https://cran.r-project.org/web/packages/utr.annotation/vignettes/introduction.pdf">vignette</a> for and introduction and examples.</p>
<p><a href="https://cran.r-project.org/package=OmicNavigator">OmicNavigator</a> v1.4.3: Provides a for interactive exploration of the results from ‘omics’ experiments to facilitate novel discoveries from high-throughput biology. There is a <a href="https://cran.r-project.org/web/packages/OmicNavigator/vignettes/OmicNavigatorUsersGuide.pdf">User’s Guide</a> and a vignette on the package’s <a href="https://cran.r-project.org/web/packages/OmicNavigator/vignettes/OmicNavigatorAPI.pdf">API</a>.</p>
<h3 id="machine-learning">Machine Learning</h3>
<p><a href="https://cran.r-project.org/package=BOSO">BOSO</a> v1.0.3: Implements the BiLevel Optimization Selector Operator feature selection algorithm for linear regression as described in <a href="https://www.biorxiv.org/content/10.1101/2020.11.18.388579v1">Valcarcel et al. (2020)</a>. See the <a href="https://cran.r-project.org/web/packages/BOSO/vignettes/BOSO.htm">vignette</a> for examples.</p>
<p><img src="Boso.png" height = "400" width="500"></p>
<p><a href="https://cran.r-project.org/package=FeatureTerminatoR">FeatureTerminatoR</a> v1.0.0: Implements a feature selection engine that removes features with minimal predictive power. See <a href="https://link.springer.com/article/10.1007%2Fs40595-018-0107-y">Boughaci (2018)</a> for background and the <a href="https://cran.r-project.org/web/packages/FeatureTerminatoR/vignettes/feature_terminatoR_howto.html">vignette</a> for and example.</p>
<p><a href="https://cran.r-project.org/package=hhcartr">hhcartr</a> v1.0.0: Implements the HHCART-G algorithm described in <a href="https://onlinelibrary.wiley.com/doi/10.1111/anzs.12275">Wickramarachchi et al. (2019)</a>. See the <a href="https://cran.r-project.org/web/packages/hhcartr/vignettes/hhcartr.pdf">vignette</a>.</p>
<p><img src="hhcartr.png" height = "500" width="400"></p>
<p><a href="https://cran.r-project.org/package=recometrics">recometrics</a> v0.1.3: Implements evaluation metrics for implicit-feedback recommender systems based on low-rank matrix factorization models, given the fitted model matrices and data. See the <a href="https://cran.r-project.org/web/packages/recometrics/vignettes/Evaluating_recommender_systems.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=tidylda">tidylda</a> v0.0.1: Implements an algorithm for Latent Dirichlet Allocation (LDA) as described in <a href="https://www.jmlr.org/papers/volume3/blei03a/blei03a.pdf">Blei et at. (2003)</a> using <a href="https://www.tidyverse.org/">tidyverse</a> principles. See <a href="https://cran.r-project.org/web/packages/tidylda/readme/README.html">README</a> for an overview.</p>
<h3 id="medicine">Medicine</h3>
<p><a href="https://cran.r-project.org/package=dcurves">dcurves</a> v0.2.0: Implements a decision curve analysis method for evaluating and comparing prediction models that incorporates clinical consequences and requires only the data set on which the models are tested. See <a href="https://journals.sagepub.com/doi/10.1177/0272989X06295361">Vickers (2006)</a>, <a href="https://bmcmedinformdecismak.biomedcentral.com/articles/10.1186/1472-6947-8-53">Vickers (2008)</a>, and <a href="https://onlinelibrary.wiley.com/doi/10.1002/bimj.201800240">Pfeiffer (2020)</a> for background, and the <a href="https://cran.r-project.org/web/packages/dcurves/vignettes/dca.html">vignette</a> for examples.</p>
<p><img src="dcurves.png" height = "200" width="300"></p>
<p><a href="https://cran.r-project.org/package=KHQ">KHQ</a> v0.2.0: Provides methods to calculate scores for each dimension of the The King’s Health Questionnaire <a href="https://obgyn.onlinelibrary.wiley.com/doi/10.1111/j.1471-0528.1997.tb11006.x">(KHQ)</a> ; converts KHQ item scores to <a href="https://journals.sagepub.com/doi/10.1177/0272989X07301820">KHQ5D</a> scores; and also calculates the utility index of the KHQ5D. See the <a href="https://cran.r-project.org/web/packages/KHQ/vignettes/KHQ.html">vignette</a>.</p>
<h3 id="science">Science</h3>
<p><a href="https://cran.r-project.org/package=AvInertia">AvInertia</a> v0.0.1: Provides functions to compute the center of gravity and moment of inertia tensor of any flying bird. See the <a href="https://cran.r-project.org/web/packages/AvInertia/vignettes/how-to-analyze-data.html">vignette</a> for some insight into bird design.</p>
<p><a href="https://cran.r-project.org/package=bayesnec">bayesnec</a> v1.0.1: Provides functions to fit dose concentration response curves to toxicity data, and derive No-Effect-Concentration (NEC), No-Significant-Effect-Concentration (NSEC), and Effect-Concentration (of specified percentage ‘x’, ECx) thresholds from non-linear models fitted using Bayesian MCMC fitting methods via <a href="https://cran.r-project.org/web/packages/brms/index.html">brms</a> and <a href="https://mc-stan.org/">Stan</a>. There are vignettes on <a href="https://cran.r-project.org/web/packages/bayesnec/vignettes/example1.html">Single model usage</a>, <a href="https://cran.r-project.org/web/packages/bayesnec/vignettes/example2.html">Multi model usage</a>, <a href="https://cran.r-project.org/web/packages/bayesnec/vignettes/example2b.html">Model details</a>, <a href="https://cran.r-project.org/web/packages/bayesnec/vignettes/example3.html">Priors</a>, and <a href="https://cran.r-project.org/web/packages/bayesnec/vignettes/example4.html">Comparing posterior predictions</a>.</p>
<h3 id="statistics">Statistics</h3>
<p><a href="https://cran.r-project.org/package=itdr">itdr</a> v1.0: Provides functions to estimate the sufficient dimension reduction subspaces, i.e., central mean subspace or central subspace in regression, using Fourier transformation proposed by <a href="https://www.tandfonline.com/doi/abs/10.1198/016214506000000140">Zhu & Zeng (2006)</a>, the convolution transformation proposed by <a href="https://www.sciencedirect.com/science/article/pii/S0047259X0900147X?via%3Dihub">Zeng & Zhu (2010)</a>, and an iterative Hessian transformation methods proposed by <a href="https://projecteuclid.org/journals/annals-of-statistics/volume-30/issue-2/Dimension-reduction-for-conditional-mean-in-regression/10.1214/aos/1021379861.full">Cook & Li (2002)</a>. See the <a href="https://cran.r-project.org/web/packages/itdr/vignettes/itdr-vignette.html">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=mlfit">mlfit</a> v0.5.2: Extends the [Iterative Proportional Fitting] <a href="https://trid.trb.org/view/881554">(IPF)</a> algorithm which operates on count data to nested structures with constraints. See <a href="https://www.research-collection.ethz.ch/bitstream/handle/20.500.11850/39167/eth-3088-01.pdf?sequence=1&isAllowed=y">Müller & Axhausen (2011)</a> for background and look <a href="https://mlfit.github.io/mlfit/">here</a> for and example.</p>
<p><a href="https://cran.r-project.org/package=optimall">optimall</a> v0.1.0: Provides functions for the survey sampling design process with specific tools for multi-wave and multi-phase designs. Users can perform optimum allocation according to <a href="https://www.jstor.org/stable/2342192?origin=crossref">Neyman (1934)</a> or <a href="https://www.tandfonline.com/doi/abs/10.1080/00031305.2012.733679">Wright (2012)</a>. There is a <a href="https://cran.r-project.org/web/packages/optimall/vignettes/optimall-vignette.html">User’s Guide</a>, there are vignettes <a href="https://cran.r-project.org/web/packages/optimall/vignettes/Multiwave-Object.html">Multiwave Object</a> and <a href="https://cran.r-project.org/web/packages/optimall/vignettes/using-optimall_shiny.html">Splitting Strata with Optimall Shiny</a>.</p>
<p><a href="https://cran.r-project.org/package=posterior">posterior</a> v1.0.1: Provides tools for both users and package developers for fitting and working with Bayesian models; including tools to: efficiently convert between different formats of draws from distributions, provide consistent methods for common operations, provide summaries in convenient formats, and implement state of the art posterior inference diagnostics. See <a href="https://projecteuclid.org/journals/bayesian-analysis/volume-16/issue-2/Rank-Normalization-Folding-and-Localization--An-Improved-R%cb%86-for/10.1214/20-BA1221.full">Vehtari et al. (2021)</a> for background. There is an <a href="https://cran.r-project.org/web/packages/posterior/vignettes/posterior.html">Introduction</a> and a vignette on the <a href="https://cran.r-project.org/web/packages/posterior/vignettes/rvar.html">Random Variable Datatype</a>.</p>
<p><a href="https://cran.r-project.org/package=PropensitySub">PropensitySub</a> v0.2.0: Provides functions to estimate treatment effects in strata via inverse probability weighting or propensity score matching when subjects have missing strata labels. See the <a href="https://cran.r-project.org/web/packages/PropensitySub/vignettes/how_to.html">vignette</a> for examples.</p>
<p><img src="psub.png" height = "200" width="400"></p>
<p><a href="https://cran.r-project.org/package=ReplicationSuccess">ReplicationSuccess</a> v1.0.0: Provides utilities for the design and analysis of replication studies featuring both traditional methods based on statistical significance and more recent methods such as the skeptical p-value <a href="https://rss.onlinelibrary.wiley.com/doi/10.1111/rssa.12493">Held L. (2020)</a>, the harmonic mean chi-squared test <a href="https://rss.onlinelibrary.wiley.com/doi/10.1111/rssc.12410">Held, L. (2020)</a>, and intrinsic credibility <a href="https://royalsocietypublishing.org/doi/10.1098/rsos.181534">Held, L. (2019)</a>. See the <a href="https://cran.r-project.org/web/packages/ReplicationSuccess/vignettes/ReplicationSuccess.pdf">vignette</a> for examples.</p>
<p><img src="RS.png" height = "200" width="400"></p>
<h3 id="time-series">Time Series</h3>
<p><a href="https://cran.r-project.org/package=kinematics">kinematics</a> V1.0.0: Provides functions to analyze time series representing two-dimensional movements. It accepts a data frame with a time (t), horizontal (x) and vertical (y) coordinate as columns, and returns several dynamical properties such as speed, acceleration or curvature. See the <a href="https://cran.r-project.org/web/packages/kinematics/vignettes/example.html">vignette</a> for examples.</p>
<p><img src="kinematics.png" height = "400" width="400"></p>
<p><a href="https://cran.r-project.org/package=profoc">profoc</a> v0.8.3: Provides methods to combine probabilistic forecasts using CRPS learning algorithms proposed in <a href="https://arxiv.org/abs/2102.00968">Berrisch & Ziel (2021)</a> including multiple online learning algorithms such as Bernstein online aggregation as described in <a href="https://arxiv.org/abs/1404.1356">Wintenberger (2014)</a>.</p>
<p><a href="https://cran.r-project.org/package=tscopula">tscopula</a> v0.2.1: Provides functions for the analysis of time series using copula models. See <a href="https://www.mdpi.com/2227-9091/9/1/14"> McNeil (2021)</a> and <a href="https://arxiv.org/abs/2006.11088">Bladt & McNeil (2020)</a> for background. There are vignettes on <a href="https://cran.r-project.org/web/packages/tscopula/vignettes/bitcoin.html">Bitcoin Analysis</a>, <a href="https://cran.r-project.org/web/packages/tscopula/vignettes/tscm_models.html">Models with Margins</a>, <a href="https://cran.r-project.org/web/packages/tscopula/vignettes/tscopulas.html">Basic Time Series Copula Processes</a>, and <a href="https://cran.r-project.org/web/packages/tscopula/vignettes/vtscopulas.html">Copula Processes with V-Transforms</a>.</p>
<p><img src="tscopula.png" height = "300" width="500"></p>
<h3 id="utility">Utility</h3>
<p><a href="https://cran.r-project.org/package=codemeta">codemeta</a> v0.1.0: Provides core utilities to generate metadata with a minimum of dependencies as specified by the <a href="https://codemeta.github.io/">Codemata Project</a>. See <a href="https://cran.r-project.org/web/packages/codemeta/readme/README.html">README</a> for examples.</p>
<p><img src="codemeta.png" height = "300" width="500"></p>
<p><a href="https://cran.r-project.org/package=ctf">ctf</a> v0.1.0: Provides functions to read and write data in Column Text Format (CTF), a new tabular data format that is a simple column store. See the <a href="https://cran.r-project.org/web/packages/ctf/vignettes/overview.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=fedmatch">fedmatch</a> v2.0.2: Provides tools for matching two un-linked data sets using exact matches, fuzzy matches, or multi-variable matches. There is an <a href="https://cran.r-project.org/web/packages/fedmatch/vignettes/Intro-to-fedmatch.html">Introduction</a> and vignettes on <a href="https://cran.r-project.org/web/packages/fedmatch/vignettes/Fuzzy-matching.html">Fuzzy Matching</a>, <a href="https://cran.r-project.org/web/packages/fedmatch/vignettes/Multivar_matching.html">Multivar Matching</a>, <a href="https://cran.r-project.org/web/packages/fedmatch/vignettes/Using-tier-match.html">Tier Matching</a>, and <a href="https://cran.r-project.org/web/packages/fedmatch/vignettes/Using-clean-strings.html">Using clean_strings</a>.</p>
<p><a href="https://cran.r-project.org/package=fusen">fusen</a> v0.2.4: Implements a method to use R Markdown to build an R package. Users start by including documentation, functions, examples and tests in the same file. Then inflating the R Markdown template copies the relevant chunks and sections in the appropriate files required for package development. There is an <a href="https://cran.r-project.org/web/packages/fusen/vignettes/How-to-use-fusen.html">Introduction</a> and a <a href="https://cran.r-project.org/web/packages/fusen/vignettes/Maintain-packages-with-fusen.html">vignette</a> on maintaining packages.</p>
<p><a href="https://cran.r-project.org/package=katex">katex</a> v1.10: Provides functions to convert <a href="https://www.latex-project.org/">LaTeX</a> math expressions to HTML and <a href="https://www.w3.org/Math/">MATHML</a> for use in markdown documents or package manual pages in a way which eliminates the need for embedding the <a href="https://www.mathjax.org/">MathJax</a> library into your web pages. See the <a href="https://cran.r-project.org/web/packages/katex/vignettes/katex-tests.html">vignette</a>.</p>
<p><img src="katex.png" height = "200" width="300"></p>
<p><a href="https://cran.r-project.org/package=pacs">pacs</a> v0.3.3: Provides utilities for CRAN package maintainers and R packages developers, including tools for validating packages and exploring the complexity of a specific package. See <a href="https://cran.r-project.org/web/packages/pacs/readme/README.html">README</a> for a list of features and examples.</p>
<p><a href="https://cran.r-project.org/package=RcppFarmHash">RcppFarmHash</a> v0.0.2 Implements an interface to the The Google <a href="https://opensource.googleblog.com/2014/03/introducing-farmhash.html">FarmHash</a> family of hash functions is used by the Google <a href="https://cloud.google.com/bigquery">BigQuery</a> data warehouse. Look <a href="https://dirk.eddelbuettel.com/code/rcpp.farmhash.html">here</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=shinyauthr">shinyauthr</a> v10.0: Provides in-app user authentication for Shiny applications, allowing developers to secure publicly hosted apps and build dynamic user interfaces from user information. See <a href="https://cran.r-project.org/web/packages/shinyauthr/readme/README.html">README</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=tangram.pipe">tantram.pipe</a> v1.0.0: Allows users to build tables with customizable rows by specifying the type of data to use for each row, as well as how to handle missing data and the types of comparison tests to run on the table columns. See the <a href="https://cran.r-project.org/web/packages/tangram.pipe/vignettes/Customizable-Table-Building.html">vignette</a>.</p>
<p><img src="tangram.png" height = "300" width="600"></p>
<h3 id="visualization">Visualization</h3>
<p><a href="https://cran.r-project.org/package=chameleon">chameleon</a> v0.2-0: Provides functions to assign distinct colors to arbitrary multi-dimensional data, considering its structure. See the <a href="https://cran.r-project.org/web/packages/chameleon/vignettes/examples.html">vignette</a> for examples.</p>
<p><img src="chameleon.png" height = "300" width="300"></p>
<p><a href="https://cran.r-project.org/package=deeptime">deeptime</a> v0.1.0: Extends plotting packages such as <code>ggplot2</code> and <code>lattice</code> to facilitate the plotting of data over long time intervals, including, but not limited to, geological, evolutionary, and ecological data. Look <a href="https://github.com/willgearty/deeptime">here</a> for examples.</p>
<p><img src="deeptime.png" height = "300" width="600"></p>
<p><a href="https://cran.r-project.org/package=figpatch">figpatch</a> v0.1.0.1: Provides functions to arrange external figures with <code>patchwork</code> alongside <code>ggplot2</code> plots. See <a href="https://cran.r-project.org/web/packages/figpatch/readme/README.html">README</a> for examples.</p>
<p><img src="patchwork.png" height = "400" width="400"></p>
<p><a href="https://cran.r-project.org/package=spiralize">spiralize</a> v1.0.2: Provides functions to visualize data along an <a href="https://en.wikipedia.org/wiki/Archimedean_spiral">Archimedean spiral</a> which has the advantages of being able to visualize data with very a long axis with high resolution and reveal periodic patterns in time series. Look <a href="https://cran.r-project.org/web/packages/spiralize/vignettes/spiralize.html">here</a> for links to the five vignettes.</p>
<p><img src="spiralize.png" height = "500" width="500"></p>
<script>window.location.href='https://rviews.rstudio.com/2021/08/26/july-2021-top-40-new-cran-packages/';</script>
R / Medicine 2021
https://rviews.rstudio.com/2021/08/12/r-medicine-2021/
Thu, 12 Aug 2021 00:00:00 +0000https://rviews.rstudio.com/2021/08/12/r-medicine-2021/
<p><img src="rmed.png" height = "500" width="100%"></p>
<p><a href="https://r-medicine.com/">R/Medicine 2021</a>, the premier conference for the use of R in clinical applications is less than two weeks away! This conference reflects the increasing importance of data science, computational statistics and machine learning to clinical applications, and emphasizes the effectiveness of the R language as a vehicle for making data driven medicine accessible to clinicians with diverse backgrounds. The two conference keynote talks <em>Bringing Machine Learning Models to the Bedside</em> by <a href="https://medicine.umich.edu/dept/lhs/karandeep-singh-md-mmsc">Karandeep Singh</a> and <em>Dissecting Algorithmic Bias</em> by <a href="https://publichealth.berkeley.edu/people/ziad-obermeyer/">Ziad Obermeyer</a> directly address important technical and ethical issues confronting modern data driven medicine.</p>
<p>R/Medicine will offer six short courses spread out over the two days of August 24th and August 25th. These courses are <strong>included in the registration price</strong>. The Tuesday short courses will be:</p>
<ul>
<li><em>Secure Medical Data Collection: Best Practices with Excel, and Leveling Up to REDCap and collaboratoR</em> taught by Peter Higgins, Will Beasley, Kenneth McLean</li>
<li><em>Intro to R for Medical Data</em> taught by Ted Laderas, Daniel Chen, Mara Alexeev</li>
<li><em>An Introductory R Guide for Targeted Maximum Likelihood Estimation in Medical Research</em> taught by Ehsan Karim</li>
</ul>
<p>The Wednesday short courses will be:</p>
<ul>
<li><em>Mapping Spatial Health Data</em> taught by Marynia Kolak</li>
<li><em>Reproducible Research with R</em> taught by Alison Hill and Stephan Kadauke</li>
<li><em>From SAS to R</em> taught by Joe Korszun</li>
</ul>
<p>The conference will proper will run from 11:00 to 19:30 EDT on Thursday, August 26th, and from 10:50 to 18:00 EDT on Friday, August 27th. The <a href="https://r-medicine.com/schedule/">full schedule is here</a>. Priced at only $50 full fare, $25 for academics and $10 for students and trainees, this is an affordable, important conference that you will not want to miss.</p>
<h3 id="you-can-register-here-https-bit-ly-2vlqger">You can <a href="https://bit.ly/2VLqGer"><strong>register here</strong></a>.</h3>
<p>To get an idea of the international scope of the conference, and a feel for what the virtual conference experience might be like, have a look at the <em>R Journal</em> article written by the organizing team about last year’s conference: <a href="https://journal.r-project.org/archive/2021-1/rmed2020.pdf"><em>R Medicine 2020: The Power of Going
Virtual</em></a>.</p>
<p>And finally, to get an idea of the various ways that R is contributing to getting everyday work done in clinical practice: the following are the packages from the Medicine category that made it to my lists of “Top 40” new CRAN packages in posts over the past twelve months.</p>
<h3 id="top-40-picks-for-new-cran-packages-for-medicine">“Top 40” Picks for new CRAN Packages for Medicine</h3>
<p><a href="https://cran.r-project.org/package=afdx">afdx</a> v1.1.1: Provides functions to estimate diagnosis performance (Sensitivity, Specificity, Positive predictive value, Negative predicted value) of a diagnostic test when there is no golden standard by estimating the attributable fraction using either a <a href="https://cran.r-project.org/web/packages/afdx/vignettes/af_logit_exponential.html">logitexponential model</a> or a <a href="https://cran.r-project.org/web/packages/afdx/vignettes/latentclass.html">latent class model</a>.</p>
<p><a href="https://cran.r-project.org/package=aldvmm">aldvmm</a> v0.8.4: Fits health state utility adjusted limited dependent variable mixture models, i.e. finite mixtures of normal distributions with an accumulation of density mass at the limits, and a gap between 100% quality of life and the next smaller utility value. See <a href="https://journals.sagepub.com/doi/10.1177/1536867X1501500307">Alava and Wailoo (2015)</a> for background and the <a href="https://cran.r-project.org/web/packages/aldvmm/vignettes/aldvmm_vignette.pdf">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=babsim.hospital">babsim.hospital</a> v11.5.14: Implements a discrete-event simulation model for a hospital resource planning. Motivated by the challenges faced by health care institutions in the current COVID-19 pandemic, it can be used by health departments to forecast demand for intensive care beds, ventilators, and staff resources. See <a href="https://www.jstatsoft.org/article/view/v090i02">Ucar, Smeets & Azcorra (2019)</a>, <a href="https://www.rcpjournals.org/content/futurehosp/6/1/17">Lawton & McCooe (2019)</a> and the <a href="https://www.th-koeln.de/informatik-und-ingenieurwissenschaften/babsimhospital_78996.php">website</a> for background, and the <a href="https://cran.r-project.org/web/packages/babsim.hospital/vignettes/babsim-vignette-introduction.pdf">vignette</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=beats">beats</a> v0.1.1: Provides functions to import data from UFI devices and process electrocardiogram (ECG) data. It also includes a Shiny app for finding and exporting heart beats. See <a href="https://cran.r-project.org/web/packages/beats/readme/README.html">README</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=bhmbasket">bhmbasket</a> v0.9.1: Provides functions to evaluate basket trial designs with binary endpoints using Bayesian hierarchical models and Bayesian decision rules. See <a href="https://journals.sagepub.com/doi/10.1177/1740774513497539">Berry et al. (2013)</a>, <a href="https://onlinelibrary.wiley.com/doi/abs/10.1002/pst.1730">Neuenschwander et al. (2016)</a> and <a href="https://link.springer.com/article/10.1177%2F2168479014533970">Fisch et al. (2015)</a> for background and the <a href="https://cran.r-project.org/web/packages/bhmbasket/vignettes/reproduceExNex.html">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=bp">bp</a> v1.0.1: Provides functions to aid in the analysis of blood pressure data of all forms by providing both descriptive and visualization tools for researchers. There is a <a href="https://cran.r-project.org/web/packages/bp/vignettes/bp.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=card">card</a> v0.1.0: Provides tools to help assess the autonomic regulation of cardiovascular physiology with respect to electrocardiography, circadian rhythms, and the clinical risk of autonomic dysfunction on cardiovascular health through the perspective of epidemiology and causality. For background on the analysis of circadian rhythms through cosinor analysis see <a href="https://tbiomed.biomedcentral.com/articles/10.1186/1742-4682-11-16">Cornelissen (2014)</a> and <a href="https://www.tandfonline.com/doi/abs/10.1080/09291010600903692">Refinetti et al. (2014)</a>. There are two vignettes: <a href="https://cran.r-project.org/web/packages/card/vignettes/circadian.html">circadian</a> and <a href="https://cran.r-project.org/web/packages/card/vignettes/cosinor.html">cosinor</a>.</p>
<p><a href="https://cran.r-project.org/package=causalCmprsk">causalCmprisk</a> v1.0.0: Provides functions to estimate average treatment effects of two static treatment regimes on time-to-event outcomes with competing events. The method uses propensity scores weighting for emulation of baseline randomization. See the <a href="https://cran.r-project.org/web/packages/causalCmprsk/vignettes/cmp_rsk_RHC.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=ccoptimalmatch">ccoptimalmatch</a> v0.1.0: Uses sub-sampling to create pseudo-observations of controls to optimally match cases with controls. See <a href="https://bmcmedresmethodol.biomedcentral.com/articles/10.1186/s12874-021-01256-3">Mamoiris (2021)</a> for the theory and the <a href="https://cran.r-project.org/web/packages/ccoptimalmatch/vignettes/ccoptimalmatching_vignette.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=CHOIRBM">CHOIRBM</a> v0.0.2: Provides functions for visualizing body map data collected with the Collaborative Health Outcomes Information Registry <a href="https://choir.stanford.edu/">CHOIR)</a>. See the <a href="https://cran.r-project.org/web/packages/CHOIRBM/vignettes/plot-one-patient.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=clinDataReview">clinDataReview</a> v1.1.0: Provides functions to create interactive tables, listings and figures and associated reports for exploratory analysis in a clinical trial setting. There are vignettes on <a href="https://cran.r-project.org/web/packages/clinDataReview/vignettes/clinDataReview-dataPreprocessing.html">Prerocessing</a>, <a href="https://cran.r-project.org/web/packages/clinDataReview/vignettes/clinDataReview-dataVisualization.html">Visualization</a>, and <a href="https://cran.r-project.org/web/packages/clinDataReview/vignettes/clinDataReview-reporting.html">Creating Reports</a>.</p>
<p><a href="https://cran.r-project.org/package=clinUtils">clinUtils</a> v0.0.4: Provides utility functions to facilitate importing, exploring, and reporting clinical data along with datasets in <a href="https://www.cdisc.org/standards/foundational/sdtm">SDTM</a> and <a href="https://www.cdisc.org/standards/foundational/adam">ADaM</a> format. See the <a href="https://cran.r-project.org/web/packages/clinUtils/vignettes/clinUtils-vignette.html">Introduction</a>.</p>
<p><a href="https://cran.r-project.org/package=cmprskcoxmsm">cmprskcoxmsm</a> v0.2.0: Provides functions to estimate treatment effect a under marginal structure model for the cause-specific hazard of competing risk events. Functions also estimate the risk of the potential outcomes, risk difference and risk ratio. See <a href="https://www.tandfonline.com/doi/abs/10.1198/016214501753168154">Hernan et al. (2001)</a> for the theory and the <a href="https://cran.r-project.org/web/packages/cmprskcoxmsm/vignettes/weight_cause_cox.pdf">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=coder">coder</a> v0.13.5: Provides functions to classify individuals or items based on external code data identified by regular expressions. A typical use case considers patients with medically coded data, such as codes from the International Classification of Diseases. There is an <a href="https://cran.r-project.org/web/packages/coder/vignettes/coder.html">overview</a> and vignettes on <a href="https://cran.r-project.org/web/packages/coder/vignettes/classcodes.html">class codes</a>, <a href="https://cran.r-project.org/web/packages/coder/vignettes/Interpret_regular_expressions.html">interpreting regular expressions</a>, and <a href="https://cran.r-project.org/web/packages/coder/vignettes/ex_data.html">example data</a>.</p>
<p><a href="https://cran.r-project.org/package=covid19us">covid19us</a> v0.1.2: Implements wrapper around the <a href="https://covidtracking.com/api/">COVID Tracking Project API</a> providing data on cases of COVID-19 in the US.</p>
<p><a href="https://cran.r-project.org/package=covidcast">covidcast</a> v0.4.2: Provides an interface to Delphi’s <a href="https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html">COVIDcast Epidata</a> including tools for data access, maps and time series plotting, and basic signal processing, and a collection of numerous indicators relevant to the COVID-19 pandemic in the United States. There is a <a href="https://cran.r-project.org/web/packages/covidcast/vignettes/covidcast.html">Getting Started Guide</a>, and vignettes on <a href="https://cran.r-project.org/web/packages/covidcast/vignettes/correlation-utils.html">Computing Signal Correlations</a>, <a href="https://cran.r-project.org/web/packages/covidcast/vignettes/external-data.html">Combining Data Sources</a>, <a href="https://cran.r-project.org/web/packages/covidcast/vignettes/multi-signals.html">Manipulating Multiple Signals</a>, and <a href="https://cran.r-project.org/web/packages/covidcast/vignettes/plotting-signals.html">Plotting and Mapping Signals</a>.</p>
<p><a href="https://cran.r-project.org/package=dataquieR">dataQuieR</a> v1.0.4: Provides functions to assess data quality issues in studies. See the <a href="https://www.tmf-ev.de/EnglishSite/Home.aspx">TMF Guideline</a> and the <a href="https://dfg-qa.ship-med.uni-greifswald.de">DFG Project</a> for background, and the <a href="https://cran.r-project.org/web/packages/dataquieR/vignettes/DQ-report-example.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=epigraphdb">epigraphdb</a> v0.2.1: Provides access to the <a href="https://epigraphdb.org">EpiGraphDB</a> platform. There is an <a href="https://cran.r-project.org/web/packages/epigraphdb/vignettes/using-epigraphdb-r-package.html">overview</a>, vignettes on the <a href="https://cran.r-project.org/web/packages/epigraphdb/vignettes/using-epigraphdb-api.html">API</a>, <a href="https://cran.r-project.org/web/packages/epigraphdb/vignettes/meta-functionalities.html">Platform Functionality</a>, <a href="https://cran.r-project.org/web/packages/epigraphdb/vignettes/meta-functionalities.html">Meta Functions</a> and three case studies on <a href="https://cran.r-project.org/web/packages/epigraphdb/vignettes/case-1-pleiotropy.html">SNP protein associations</a>, <a href="https://cran.r-project.org/web/packages/epigraphdb/vignettes/case-2-alt-drug-target.html">Drug Targets</a> and <a href="https://cran.r-project.org/web/packages/epigraphdb/vignettes/case-3-literature-triangulation.html">Causal Evidence</a></p>
<p><a href="https://cran.r-project.org/package=EpiNow2">EpiNow2</a> v1.2.1: Provides functions to estimate the time-varying reproduction number, rate of spread, and doubling time using a range of open-source tools <a href="https://wellcomeopenresearch.org/articles/5-112/v1">Abbott et al. (2020)</a> for background, <a href="https://www.medrxiv.org/content/10.1101/2020.06.18.20134858v3">Gostic et al. (2020)</a> for current best practices, and <a href="https://cran.r-project.org/web/packages/EpiNow2/readme/README.htm">README</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=escalation">escalation</a> v0.1.2: Implements methods for working with dose-finding clinical trials and includes a common interface to various dose-finding methodologies such as the continual reassessment method (CRM) by <a href="https://www.jstor.org/stable/pdf/2531628.pdf?seq=1">O’Quigley et al. (1990)</a>, the Bayesian optimal interval design (BOIN) by <a href="https://mdanderson.elsevierpure.com/en/publications/bayesian-optimal-interval-designs-for-phase-i-clinical-trials">Liu & Yuan (2015)</a>, and the 3+3 described by <a href="https://onlinelibrary.wiley.com/doi/abs/10.1002/sim.4780131802">Korn et al. (1994)</a>. There are vignettes on <a href="https://cran.r-project.org/web/packages/escalation/vignettes/DosePaths.html">Working with dose-paths</a>, <a href="https://cran.r-project.org/web/packages/escalation/vignettes/DoseSelectorInterface.html">Working with dose selectors</a>, and
<a href="https://cran.r-project.org/web/packages/escalation/vignettes/Simulation.html">Simulating dose-escalation trials</a>.</p>
<p><a href="https://cran.r-project.org/package=eventglm">eventglm</a> v1.0.2 Implements methods for doing event history regression for marginal estimands, including cumulative incidence the restricted mean survival, as described in the methodology reviewed in <a href="https://journals.sagepub.com/doi/10.1177/0962280209105020">Andersen & Perme (2010)</a>. See the <a href="https://cran.r-project.org/web/packages/eventglm/vignettes/example-analysis.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=eventTrack">eventTrack</a> v1.0.0: Implements the hybrid framework for event prediction in clinical trials as described in <a href="https://www.sciencedirect.com/science/article/pii/S155171441100139X?via%3Dihub">Fang & Zheng (2011)</a>. See the <a href="https://cran.r-project.org/web/packages/eventTrack/vignettes/eventTrack.html">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=goldilocks">goldilocks</a> v0.3.0: Implements the Goldilocks adaptive trial design for a time to event outcome using a piecewise exponential model and conjugate Gamma prior distributions as described in <a href="https://www.tandfonline.com/doi/abs/10.1080/10543406.2014.888569?journalCode=lbps20">Broglio et al. (2014)</a>. See the <a href="https://cran.r-project.org/web/packages/goldilocks/vignettes/broglio.html">vignette</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=healthyR">healthyR</a> v0.1.1: Implements hospital data analysis workflow tools including modeling tools, and tools to review common administrative hospital data such as average length of stay, readmission rates, average net pay amounts by service lines, and more. See the <a href="https://cran.r-project.org/web/packages/healthyR/vignettes/getting-started.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=hlaR">hlaR</a> v0.1.0: Implements a tool for the eplet analysis of donor and recipient HLA (human leukocyte antigen) mismatches. There are vignettes on <a href="https://cran.r-project.org/web/packages/hlaR/vignettes/allele-haplotype.html">Imputation</a> and <a href="https://cran.r-project.org/web/packages/hlaR/vignettes/eplet-mm.html">Eplet Mismatch</a> and a <a href="https://emory-larsenlab.shinyapps.io/hlar_shiny/">Shiny App</a> as well.</p>
<p><a href="https://cran.r-project.org/package=inTextSummaryTable">inTextSummaryTable</a> v3.0.1: Provides functions to create tables of summary statistics or counts for clinical data for <a href="https://www.pharmasug.org/proceedings/2015/CP/PharmaSUG-2015-CP04.pdf">TLFs</a>. These tables can be exported as in-text table for a Clinical Study Report in MS Word format or a presentation MS PowerPoint format, or as interactive table. There is an <a href="https://cran.r-project.org/web/packages/inTextSummaryTable/vignettes/inTextSummaryTable-introduction.html">Introduction</a> and six more vignettes including <a href="https://cran.r-project.org/web/packages/inTextSummaryTable/vignettes/inTextSummaryTable-aesthetics.html">Aesthetics</a> and <a href="https://cran.r-project.org/web/packages/inTextSummaryTable/vignettes/inTextSummaryTable-visualization.html">Visualization</a>.</p>
<p><a href="https://cran.r-project.org/package=IPDfromKM">IPDfromKM</a> v0.1.10: Implements a method to reconstruct individual patient data from Kaplan-Meier (KM) survival curves, visualize and assess the accuracy of the reconstruction, and perform secondary analysis on the reconstructed data. The package also implements iterative KM estimation algorithm proposed in <a href="https://bmcmedresmethodol.biomedcentral.com/articles/10.1186/1471-2288-12-9">Guyot (2012)</a>.</p>
<p><a href="https://cran.r-project.org/package=metaSurvival">metaSurvival</a> v0.1.0: Provides a function to assess information from a summary survival curve and test the between-strata heterogeneity. See the <a href="https://github.com/shubhrampandey/metaSurvival">GitHub repo</a> for an example.</p>
<p><a href="https://cran.r-project.org/package=nCov2019">nCov2019</a> v0.4.4: Implements an interface to <a href="https://disease.sh/">disease.sh - Open Disease Data API</a> to access real time and historical data of COVID-19 cases, vaccine and therapeutics data. There is a <a href="https://cran.r-project.org/web/packages/nCov2019/vignettes/nCov2019.html">vignette</a>.</p>
<p><a href="https://cran.r-project.org/package=NHSDataDictionaRy">NHSDataDictionaRy</a> v1.2.1: Provides a common set of simplified web scraping tools for working with the <a href="https://datadictionary.nhs.uk/data_elements_overview.html">NHS Data Dictionary</a>.This package was commissioned by the <a href="https://nhsrcommunity.com/">NHS-R community</a> to provide this consistency of lookups. See the <a href="https://cran.r-project.org/web/packages/NHSDataDictionaRy/vignettes/introduction.html">vignette</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=NMADiagT">NMADiagT</a> v0.1.2: Implements the hierarchical summary receiver operating characteristic model developed by <a href="doi:10.1093/biostatistics/kxx025">Ma et al. (2018)</a> and the hierarchical model developed by <a href="doi:10.1080/01621459.2018.1476239">Lian et al. (2019)</a> for performing meta-analysis. It is able to simultaneously compare one to five diagnostic tests within a missing data framework.</p>
<p><a href="https://cran.r-project.org/package=packDAMipd">packDAMipd</a> v0.1.2: Provides functions to construct both time-homogenous and time-dependent Markov models for cost-effectiveness analyses, perform decision analyses, and conduct deterministic and probabilistic sensitivity analyses. There are vignettes on <a href="https://cran.r-project.org/web/packages/packDAMipd/vignettes/Deterministic_sensitivity_analysis.html">deterministic</a> and <a href="https://cran.r-project.org/web/packages/packDAMipd/vignettes/Probabilstic_sensitivity_analysis.html">probabilistic</a> sensitivity analyses, <a href="https://cran.r-project.org/web/packages/packDAMipd/vignettes/Simple_sick_sicker.html">simple</a> “sick-sicker” models, <a href="https://cran.r-project.org/web/packages/packDAMipd/vignettes/Sick_sicker_age_dependent.html">age-dependent</a> “sick-sicker” models, and <a href="https://cran.r-project.org/web/packages/packDAMipd/vignettes/cycle_dependent.html">cycle dependent</a> models.</p>
<p><a href="https://cran.r-project.org/package=patientProfilesVis">patientProfilesVis</a> v2.0.1: Provides functions to create patient specific profile visualizations for exploration, diagnostic or monitoring purposes during a clinical trial which display the evolution of parameters such as laboratory measurements, ECG data, vital signs, adverse events and more. There is <a href="https://cran.r-project.org/web/packages/patientProfilesVis/vignettes/patientProfiles-template-SDTM.html">template</a> for creating patient profiles from CDISC SDTM datasets, and an <a href="https://cran.r-project.org/web/packages/patientProfilesVis/vignettes/patientProfilesVis-introduction.html">Introduction</a> to the package.</p>
<p><a href="https://cran.r-project.org/package=psrwe">psrwe</a> v1.2: Provides tools to incorporate real-world evidence (RWE) into regulatory and health care decision making and includes functions which implement the PS-integrated RWE analysis methods proposed in <a href="https://www.tandfonline.com/doi/abs/10.1080/10543406.2019.1657133?journalCode=lbps20">Wang et al. (2019)</a>, <a href="https://www.tandfonline.com/doi/abs/10.1080/10543406.2019.1684309?journalCode=lbps20">Wang et al. (2020)</a>, and <a href="https://www.tandfonline.com/doi/abs/10.1080/10543406.2020.1730877?journalCode=lbps20">Chen et al. (2020)</a>. There is a <a href="https://cran.r-project.org/web/packages/psrwe/vignettes/vignette.html">vignette</a> on propensity score integration.</p>
<p><a href="https://cran.r-project.org/package=QDiabetes">QDiabetes</a> v1.0-2: Calculates the risk of developing type 2 diabetes using risk prediction algorithms derived by <a href="https://clinrisk.co.uk/ClinRisk/Welcome.html">ClinRisk</a>. Look <a href="https://github.com/Feakster/qdiabetes">here</a> for information and examples.</p>
<p><a href="https://cran.r-project.org/package=raveio">raveio</a> v0.0.3: implements an interface to the <a href="https://openwetware.org/wiki/RAVE">RAVE</a> (R analysis and visualization of human intracranial electroencephalography data) project which aims at analyzing brain recordings from patients with electrodes placed on the cortical surface or inserted into the brain. See <a href="https://www.biorxiv.org/content/10.1101/2020.06.02.129676v1">Mafnotti et al. (2020)</a> for background.</p>
<p><a href="https://cran.r-project.org/package=reconstructKM">reconstructKM</a> v0.3.0: Provides functions for reconstructing individual-level data (time, status, arm) from Kaplan-MEIER curves published in academic journals. See <a href="https://www.nejm.org/doi/10.1056/NEJMc1808567">Sun et al. (2018)</a> for background and the <a href="https://cran.r-project.org/web/packages/reconstructKM/vignettes/introduction.html">vignette</a> for the reconstruction procedure.</p>
<p><a href="https://cran.r-project.org/package=ReviewR">RevieweR</a> v2.3.6: Implements a portable <code>Shiny</code> tool to explore patient-level electronic health record data and perform chart review in a single integrated framework. This tool supports the <a href="https://www.ohdsi.org/data-standardization/the-common-data-model/">OMOP</a> common data model as well as the <a href="https://mimic.physionet.org/">MIMIC-III</a> data model, and chart review through a <a href="https://www.project-redcap.org/">REDCap</a> API. See the <a href="https://reviewr.thewileylab.org/">RevieweR Website</a> for more information. There are several vignettes including <a href="https://cran.r-project.org/web/packages/ReviewR/vignettes/deploy_local.html">Local</a>, <a href="https://cran.r-project.org/web/packages/ReviewR/vignettes/deploy_docker.html">Docker</a>, <a href="https://cran.r-project.org/web/packages/ReviewR/vignettes/deploy_bigquery.html">BigQuery</a> and <a href="https://cran.r-project.org/web/packages/ReviewR/vignettes/deploy_server.html">Shiny Server</a> deployment and performing a <a href="https://cran.r-project.org/web/packages/ReviewR/vignettes/usage_perform_chart_review.html">Chart Review</a>.</p>
<p><a href="https://cran.r-project.org/package=RHRT">RHRT</a> v1.0.1: Provides methods to scan RR interval data for Premature Ventricular Complexes and parameterise and plot the resulting Heart Rate Turbulence. See <a href="https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(98)08428-1/fulltext">Schmidt et al. (1999)</a> and <a href="https://iopscience.iop.org/article/10.1088/1361-6579/ab98b3">Blesius et al. (2020)</a> and the <a href="https://cran.r-project.org/web/packages/RHRT/vignettes/rhrt-vignette.html">vignette</a> for examples.</p>
<p><a href="https://cran.r-project.org/package=SAMBA">SAMBA</a> v0.9.0: Implements several methods, as proposed in <a href="doi:10.1101/2019.12.26.19015859">Beesley & Mukherjee (2020)</a> for obtaining bias-corrected point estimates along with valid standard errors using electronic health records data with misclassifird EHR-derived disease status. See the <a href="https://cran.r-project.org/web/packages/SAMBA/vignettes/UsingSAMBA.html">vignette</a> for details.</p>
<p><a href="https://cran.r-project.org/package=SteppedPower">SteppedPower</a> v0.1.0: Provides tools for power and sample size calculations and design diagnostics for longitudinal mixed models with a focus on stepped wedge designs using methods introduced in <a href="https://www.sciencedirect.com/science/article/pii/S1551714406000632?via%3Dihub">Hussey and Hughes (2007)</a> and extensions discussed in <a href="https://journals.sagepub.com/doi/10.1177/0962280220932962">Li et al. (2020)</a>. See the <a href="https://cran.r-project.org/web/packages/SteppedPower/vignettes/Getting_Started.html">vignette</a> to get started.</p>
<p><a href="https://cran.r-project.org/package=tboot">tboot</a> v0.2.0: Provides functions to simulate clinical trial data with realistic correlation structures and assumed efficacy levels by using a tilted bootstrap resampling approach. There is a tutorial on <a href="https://cran.r-project.org/web/packages/tboot/vignettes/tboot.html">The Tilted Bootstrap</a> and another on <a href="https://cran.r-project.org/web/packages/tboot/vignettes/tboot_bmr.html">Bayesian Marginal Reconstruction</a>.</p>
<p><a href="https://cran.r-project.org/package=Tplyr">Tplyr</a> v0.1.3: Implement a tool to simplify table creation and the data manipulation necessary to create clinical reports. There is a <a href="https://cran.r-project.org/package=Tplyr">Getting Started Guide</a>, and vignettes on <a href="https://cran.r-project.org/web/packages/Tplyr/vignettes/desc.html">Layers</a>, <a href="https://cran.r-project.org/web/packages/Tplyr/vignettes/options.html">Options</a>, and <a href="https://cran.r-project.org/web/packages/Tplyr/vignettes/table.html">Tables</a>.</p>
<p><a href="https://cran.r-project.org/package=visR">visR</a> v0.2.0: Provides functions to generate clinical graphs and tables with sensible defaults based on graphical principles as described in: <a href="https://onlinelibrary.wiley.com/doi/10.1002/pst.1912">Vandemeulebroecke et al. (2018)</a>, <a href="https://ascpt.onlinelibrary.wiley.com/doi/10.1002/psp4.12455">Vandemeulebroecke et al. (2019)</a>, and <a href="https://bmjopen.bmj.com/content/9/9/e030215">Morris et al. (2019)</a>. Vignettes include <a href="https://cran.r-project.org/web/packages/visR/vignettes/CDISC_ADaM.html">Survival Analysis using CDISC ADaM standard</a>, <a href="https://cran.r-project.org/web/packages/visR/vignettes/Consort_flow_diagram.html">Creating Consort Flow Diagram</a>, <a href="https://cran.r-project.org/web/packages/visR/vignettes/Styling_KM_plots.html">Styling Survival Plots</a> and <a href="https://cran.r-project.org/web/packages/visR/index.html">Survival Analysis</a>.</p>
<script>window.location.href='https://rviews.rstudio.com/2021/08/12/r-medicine-2021/';</script>
R Views Call for Documentation
https://rviews.rstudio.com/2021/08/04/r-views-blog-contest/
Wed, 04 Aug 2021 00:00:00 +0000https://rviews.rstudio.com/2021/08/04/r-views-blog-contest/
<p>We at R Views believe that the R ecosystem, centered around CRAN and Bioconductor, is the world’s largest open repository of statistical knowledge. R packages provide implementations and examples for a tremendous number of statistical methods, procedures, and algorithms. Yet, the virtual library of the R ecosystem is far from being complete. There is plenty of room for examples that explore some little travelled path of computational statistics or illuminate a familiar field with clarity. We invite you to contribute to expanding the knowledge available in the R ecosystem through blogging.</p>
<p>Documentation for R packages begins with the package pdf file which provides a detailed description for each individual function, indicates relationships among functions and often includes references to the statistical and scientific literature. Going down an organizational level you can view the source code for each function. Moving up a level, README files and package vignettes provide a coherent overview of the capabilities of the package as a whole and often include example and elaborate use cases.</p>
<p>While the burden to explain what R packages do falls mainly on package authors, all of us data scientists, statisticians, researchers, students and “ordinary” R users can add to the knowledge encoded in R by elaborating on the capabilities of R functions and packages, developing additional examples and contributing statistical analyses in areas where we may have developed some expertise.</p>
<p><img src="https://imgs.xkcd.com/comics/unpublished_discoveries.png" height = "300" width="500">
<sup><a href="https://www.explainxkcd.com/wiki/index.php/1805:_Unpublished_Discoveries">xkcd 1805 Unpublished Discoveries</a></sup></p>
<p>We are not talking about Nobel Laureate work here. But nearly everyone who regularly uses R has some gem stashed away somewhere. We are looking to mine those gems and organize them in a way that can be shared with the R Community.</p>
<p>We are asking you to please dig up your gem and organize it into a blog post. Tell us what your gem does, how it works, and why it is of some value. Some of the most popular R Views posts introduce technical topics by providing R based tutorials. Others show how to efficiently accomplish everyday tasks or present an elegant calculation or visualization. Think in terms of a well explained example, or if you are really ambitious, you could write that package vignette that you wish existed. Look below for some guidance on more elaborate ideas.</p>
<h2 id="call-for-posts">Call for Posts</h2>
<p>Please submit you posts using the following form: <a href="https://rstd.io/rviews-2021">rstd.io/rviews-2021</a>. All submissions will appear on the <a href="https://community.rstudio.com/c/60"><em>Call for Docs</em></a> page on the RStudio Community Site, and you will need an RStudio Community profile.</p>
<p>The deadline for submission is <strong>Friday, September 23, 2021</strong>. We planning awards of a sort to the best entries and would like to announce these by November 1, 2021.</p>
<h3 id="awards">Awards</h3>
<p>The award categories and the associated prizes are as follows:</p>
<ul>
<li><strong>Honorable Mentions</strong>:
<ul>
<li>One year free RStudio Cloud Premium</li>
<li>A bunch of hex stickers of RStudio packages</li>
</ul></li>
<li><strong>Runners Up</strong>:
<ul>
<li>All prizes listed above, plus</li>
<li>Some number of RStudio t-shirts, books, and mugs (worth up to $200)</li>
</ul></li>
<li><strong>Grand Prizes</strong>:
<ul>
<li>All prizes listed above, plus</li>
<li>Special & persistent recognition by RStudio in the form of a winners page, and a badge that will be publicly visible on your RStudio Community profile</li>
<li>A selected group of submissions will be invited to appear on R Views</li>
</ul></li>
</ul>
<p><sup>* Please note that we may not be able to send t-shirts, books, or other larger items to non-US addresses.</sup><br>
<sup>* Please note that all articles on R Views will go through an editorial review before being published there.</sup><br>
<sup>* With the author’s permission, some posts may appear on R Views before the awards announcements. </sup>.</p>
<h3 id="announcement">Announcement</h3>
<p>The names and work of all winners will be highlighted in an announcement on R Views, and we will announce them on RStudio’s social platforms, including RStudio Community (unless the winner prefers not to be mentioned).</p>
<h2 id="need-inspiration">Need inspiration?</h2>
<ul>
<li>Edgar Ruiz <a href="https://rviews.rstudio.com/2019/06/19/a-gentle-intro-to-tidymodels/">Gentle Introduction to tidymodels</a> is a good example of a homemade package vignette.</li>
<li>Jonathan Regenstein’s series on <a href="https://rviews.rstudio.com/categories/reproducible-finance-with-r/">Reproducible Finance with R</a> presents several masterful examples of Financial use cases.</li>
</ul>
<h2 id="guidance">Guidance</h2>
<ul>
<li>Posts should be well-written, contain enough code to support the main argument and have a few plots and/or tables.</li>
<li><strong>Novelty</strong> - We are looking for original content. That is, your article should not have appeared on blogging platforms, other than your personal website or blog.</li>
<li><strong>Contribution</strong> - Your article should provide novel insight and utility. For example, an exploration of a package or use case that is currently poorly documented will be better received than one which already has excellent documentation and vignettes either on CRAN or in the R community.</li>
<li><strong>Reproducible</strong> - Your submission will need to link to a repo which includes an .Rmd file that reproduces all code, images, and other output in the submitted article. If there is code that requires special resources, such as access to a private database, it is fine to simply refer to these in your repo.</li>
<li><strong>Please confine your posts to less than 1,000 words</strong>, excluding code and image captions. Your article should be self-contained, but may refer to additional content on your repo or personal website.</li>
</ul>
<h3 id="categories">Categories</h3>
<ul>
<li><strong>Homemade Package Vignette</strong> - Package authors put in a lot of effort to build their library and the documentation that supports it, but they can’t cover everything. They may not have developed a vignette yet, or written additional documentation explaining the set of functionality that is especially useful.
With this type of article, introduce readers to a package – or small group of packages – highlighting interesting features or extensions. It should not replicate any existing documentation, instead it should be distinct from – and complementary to – any existing package documentation.</li>
<li><strong>Entry Point into a Topic</strong> - It’s often daunting to get started as you’re exploring a new field or approaching a new problem or methodology. It’s incredibly pleasing when you find the resource that serves as your entry point into that new domain, demystifying the space, pointing out useful packages and examples, getting you started on your work. With this article type, explore resources centered around one problem, highlighting how R helps you approach it.</li>
</ul>
<script>window.location.href='https://rviews.rstudio.com/2021/08/04/r-views-blog-contest/';</script>