Rstats

Get the Office Quotes in R with the dundermifflin Package

Introduction I am happy to share a fun project I put together this weekend - a new R package called dundermifflin. If you can’t guess from the name, it will give you quotes from the Office whenever you want! This package was inspired by the goodshirt package, which gives users quotes from The Good Place, I was able to great a similar package for the Office. By using theOffice-api, I created a data set, office_quotes, that is shipped with the package, that has every line from the Office, with the exception of season 5.

Using Scoped dplyr verbs

Introduction Over the past several months, I have really started to increase the amount that I have been using scoped dplyr verbs. For those of you who don’t know about these functions, they are handy variants to the normal dplyr verbs, such as filter, mutate, and summarize, that allow you to target multiple columns or all of your columns. These functions allow for you to save yourself time and typing when you want to apply either one or multiple functions to more than one column, a group of columns, or to all of your columns.

Calculating quantiles for groups with dplyr::summarize and purrr::partial

Recently, I was trying to calculate the percentiles of a set of variables within a data set grouped by another variable. However, I quickly ran into the realization that this is not very straight forward when using dplyr’s summarize. Before I demonstrate, let’s load the libraries that we will need. library(dplyr) library(purrr) If you don’t believe me when I say that it is not straight forward, go ahead and try to run the following block of code.

Tracking Joey Wendle's rookie season with gganimate

Introduction This past weekend I got the chance to go to the Tampa Bay Rays vs Cleveland Indians game. This game was a ton of fun, made even more exciting for me - and by the end of the game, the people in my section - because my brother-in-law’s brother (does that make him my brother-in-law too? No one ever knows for sure…), Joey Wendle, plays for the Rays! In case you haven’t been paying attention, Joey has been having a MASSIVE rookie season.

Add RStudio Community to your blogs social links - Blackburn Theme

Introduction Recently, I switched themes for my blog to the blackburn theme and I love it! Luckily, the blogdown package makes this super easy to do within R! If you haven’t used blogdown, I highly recommend you take a look at it for setting up your blog. One of the nice features of the blackburn theme, is that it provides easy to add “social” tags that can be configured in your config.

Create a dynamic number of UI elements in Shiny with purrr

Introduction purrr is an incredibly powerful package that has greatly enhanced my R programming abilities. purrr has applications in pretty much any situation. One of the most useful situations, IMHO, is in the creation of a dynamic number of shiny UI elements. This can be extremely useful if you want to be able to create a dynamic number of ui elements (whether that be inputs or outputs) based on either user selection or the data being used.

Using global input values inside of R Shiny modules

Introduction This week, I have been working on a new shiny app. This app allows for similar figures to be rendered based on which summary statistic the user is interested in. There are four different figure types for the user to choose from, each of which are placed into their own tabPanel. This means copying the server code used to generate the graphs four different times. Following Hadley’s words of wisdom in R for Data Science, I wanted to abstract this process into functions.

Subsetting Phylogenetic Trees

Introduction In the past few months, I have been introduced to and started working with phylogenetic trees. The trees I have been working with contain the entire tree of life for bacteria. Needless to say, they are huge. At first, I was told that I could download a program that would let me view the tree and search for particular species on the tree, but of course, I immediately looked for a better solution using R.

PCA in a tidy(verse) framework

Introduction The other day, a question was posted on RStudio Community about performing Principal Component Analysis (PCA) in a tidyverse workflow. Conveniently, I had literally just worked through this process the day before and was able to post an answer. While most questions and answers are good as they are on forum sites, I thought this one might be worth exploring a little more since using the tidyverse framework makes PCA much easier, in my opinion.

Creating, Writing, Querying, and Modifying SQL Database from R using odbc, dbplyr, and DBI

Introduction Recently, I have been building shiny apps for work. The app that I am currently working on is an interface to a database for storing information about laboratory samples being collected. In addition to building the shiny app for my coworkers to interact with the database, I also was tasked with creating and building the database. I have never build a SQL database from scratch, but luckily the odbc and the DBI packages make it fairly straight foreward.

Exploring English Premier League Historical Match Results

Introduction I was listening to Jeff Atwood’s interview on the podcast Developer on Fire and he said something that struck home with me. It was along the lines of, “The best time to start blogging is yesterday.” I have been considering starting a blog about #rstats but had been putting it off because of any number of reasons. But after listening to his interview, I decided now was as good of a time as any.