# Category Thoughts and Things

## What I Read, 2018 Edition

Following my highly successful – I liked it, I mean – 2017 end of year book list, I have decided to make the post a tradition.  What follows is the list, in chronological order, of books I finished in 2018.  If I put an asterisk after the title, it means I started the book in 2017. American […]

## Who I Saw, 2018 Edition

My wife has supernatural face memory and always sees celebrities when we are together. I am sure I saw many more celebrities without realizing it.  Overall, fun sightings, but not as awesome as 2017 (Fred Armisen, Jemaine from New Zealand and Flight of the Conchords, Abbi from Broad City). The following entries are in chronological order. Josh Flagg (January) […]

## Assign Country Code to Tweets Based on GPS Coordinates

[UPDATE: THE BELOW CODE WAS DESIGNED FOR TWEETS THAT HAD BEEN ALREADY FORMATTED TO .CSV.  I HAVE UPDATED THE CODE TO WORK WITH RAW TWEETS.  THE GITHUB PAGE HAS LIKEWISE BEEN UPDATED.] When looking at tweets, it is often important to know where the tweet was created.  For tweets with GPS coordinates, Twitter is nice […]

## Placing Text Within an R Plot

I often add text in plots. This text can be a legend or labeling certain points, in which case assigning it x and y coordinates are easy. Often times, the text is descriptive, e.g. the slope of a line or the number of observations in a sample. Customizing (x,y) coordinates in that case is simple […]

## ggstance for Two Treatment Effects

I was making a plot comparing how five outcomes varied by whether they occurred during Period 1 or Period 2.  I wanted to plot the standard error of each point, which would often cause points to become hidden by the error bars.  The obvious answer is to shift the 10 points (5 outcomes, 2 treatments) […]

## Add Interaction Variables as Needed

In today’s edition of Becoming a Functional Data Analyst, I am writing to remind myself not to create interaction variables during data munging.  That is, when acquiring, cleaning, and aggregating data, I find it easier to not interact variables I will later need.  Instead, it is easier to keep variables as they are and only […]

## Making HTML Tables in R

TL;DR: htmlTable and tableHTML are better than xtable for creating HTML tables in R. Today, I had to make tables for a Word document, meaning I could not convert my R table to Latex code.  (I know I know, pandoc.  Just another crusty old thing to learn.)  In the past, I had used xtable, but […]

## Reason #1 Why I Don’t like ggplot

[UPDATE: My best use of academic Twitter yet.  I tweeted a link to this post and quickly got pwnd by the internet.  What I learned:  there is a function, ggsave(), that does this that I did not know about.  So use that instead of the hacky workaround I came up with.  Never would’ve learned if […]

## The Lazy Way Around Updating my gcc Compiler

Today, I need to launch a new AWS EC2 instance to collect some more tweets.  Since I have done this several times, I used my AWS console to replicate the most recent instance I created that collects tweets.  Everything ran smoothly until I tried to install streamR, my go to library for collecting tweets in […]

## A Slightly Less Simple Function for Forest Plots

This post is a sequel to my wildly popular – ok, not wildly popular, but very useful for me – post documenting my function to create a forest plot.  Recently, I made models using cross-validation via R’s caret package.  The train() function does the heavy lifting, but the problem is that its output is a […]