# R

Background For the past several months, I have been working on an analysis on the effects of urban heat on vulnerable populations, particularly during a public health crisis. For some background, I currently live in Las Vegas, where summer heat can exceed 110 degrees. Last summer included a 45-day-long streak of temperatures over 100 degrees. Urban heat is not distributed evenly within cities. Features such as parks or ponds can lead to cooler temperatures in some areas, while areas without foliage or with dark surfaces such as roads and buildings lead to warmer temperatures.
2021-02-13
Note 2: Now that the 2020 Census has concluded, the embedded Shiny app has been shut down. I&rsquo;ve left the code used to embed the app on the site, and I&rsquo;ve linked to a blog post with screenshots of the app itself. But the app itself is no longer linked and no longer embedded here. Note: This post was updated on 2020-07-10 with a new version of the Shiny app. I recently developed an R Shiny app for tracking the daily 2020 census numbers in Nevada.
2020-04-07
Contents Table of Contents Contents Introduction Base R Figure in Base R with Default Options High-Resolution Figure with Incorrect Figure Component Dimensions in Base R High-Resolution Figure with Correct Font Sizes in Base R High-resolution figures in ggplot Figure in ggplot2 with default options Figure in ggplot2 with higher resolution Formatted, high-resolution ggplot2 figure Introduction In this post, I go over the process for exporting high-resolution graphics of the desired size with consistent layouts and font sizes.
2020-01-22
In this post, we attempt to embed an interactive plot generated using plot_ly in this web page. The plot was generated in R. We are following this guide to embed the interactive figure. Some context: the figure below depicts the change in enrollment in health insurance through the HealthCare.gov marketplace (the federal marketplace established through the Affordable Care Act) from coverage year 2019 to coverage year 2020. A static version of this figure was made using ggplot.
2020-01-08
Introduction This is a followup to a prior post on the same topic, where I used R’s base plotting system to visualize a linear programming provelm. I’m again looking at section 1.4 of Introduction to Linear Optimization. This time, we’ll consider Example 1.8 on page 23 (Bertsimas and Tsitsiklis 1997, 23). The optimization problem in this example is: \begin{align*} -x_1+x_2 &amp;\leq 1 \\ x_1 &amp;\geq 0 \\ x_2 &amp;\geq 0 \end{align*} Some preliminary notes This time, instead of using the base R package, we’re going to plot the problem using the ggplot2 package (Wickham 2009).