R

R Rainbows: Making a Pride Flag in R

🌈HAPPY PRIDE MONTH!! Fun fact: my rainbow Twitter banner (which I keep up year-round) was actually made using R! Given that pride season is officially upon us, I thought it’d be fun to share the code I wrote to generate a quick, fun ggplot rainbow flag. To make the flag, I wrote a function, rainbow_flag(), which depends on one parameter, n. This will control how many colors of the rainbow I want to use (see examples below).

Formatting Math Symbols and Expressions in ggplot Labels

Yesterday, I was trying to put some finishing touches on a figure I made in ggplot2 that visualizes some simulation results. The plot features several panels using facet_grid(), and uses colors to distinguish between different regression models that were fit to the simulated data. I wanted to label certain axes and panel names using the Greek letters I had used as parameter notation, and I also wanted the labels in the color legend to correspond to the different regression models I had fit.

Tidy Tuesday Week 29: Economic Guide to Picking a College Major

This is my first time doing 🎉Tidy Tuesday🎉 ! The data for this week came from a FiveThirtyEight blogpost, which breaks down post-college salaries by discipline. The documentation and data for this week can be found in this GitHub repo. One thing I found really interesting in the data was the variable College_jobs, which counted the number of people per major with jobs that required a college degree. I wanted to use this information to look at each major’s median income by percent of recent grads employed in positions requiring/not requiring college degrees.

Tidying and Visualizing TV Ratings Data in R

About three years ago, I received a letter in the mail from Nielsen inviting me to participate in one of their panels. After spending a while on the phone with a representative to determine that it wasn’t a scam, I figured I’d give it a go. I tend to take great interest in knowing where data come from (especially when reporters and media sources try to use statistics to make a point), and as an avid tv watcher, it was cool to learn more about how Nielsen generates ratings and estimates program viewership.