Blog Archives

User Input in R vs Python

April 18, 2012
By

Both R and Python have facilities where the coder can write a script which requests a user to input some information. In Python 2.6, the main function for this task is raw_input (in Python 3.0, it’s input()). In R, there are a series of functions that can be used to request an input from the user,

Read more »

Analyzing Twitter Data in R – Part 1

February 8, 2012
By

I recently began using the TwitteR package in R to examine my tweeting patterns. One of my first projects was to identify each of my Twitter followers, where they were located, how many tweets they had, and then plot their location on a map using a bubble which was related to their total number of

Read more »

Job Satisfaction in England – GGPlot #2

November 29, 2011
By
Job Satisfaction in England – GGPlot #2

I’ve recently been scouring the internet for a public opinion data set pertaining to job satisfaction. I was particularly interested in examining how gender, age, and socio-economic status influence how satisfied an individual is with their current employment situation. For example, existing research suggests that women and private-sector employees tend to have higher levels of

Read more »

A/B Testing in R – Part 1

November 29, 2011
By

A/B testing is a method for comparing the effectiveness of several different variations of a web page. For example, an online clothing retailer that specializes in mens’ streetwear may want to examine whether a black or pink background results in more purchases from visitors to the site. Lets say that our online store is just

Read more »

R 101: The Subset Function

November 9, 2011
By

The subset function is available in base R and can be used to return subsets of a vector, martix, or data frame which meet a particular condition. In my three years of using R, I have repeatedly used the subset() function and believe that it is the most useful tool for selecting elements of a

Read more »

Generating PPC Keywords in R – Part 2

November 4, 2011
By

In a previous post, I discussed how to generate PPC keywords in R. In this post I will provide another example of how to perform this task. Let’s say that I am a auto insurance company that only operates in the state of Illinois. I’m planing on bidding on keywords in Bing and Google which

Read more »

Generating PPC Keywords in R

November 1, 2011
By

Paid search marketing refers to the process of driving traffic to a website by purchasing ads on search engines. Advertisers bid on certain keywords that users might search for, and that determines when and where their ads appear. For example, an individual who owns an auto dealership would want to bid on keywords relating to automobiles

Read more »

Shoe Consumption in the U.S. – GGPlot2 #1

October 26, 2011
By
Shoe Consumption in the U.S. – GGPlot2 #1

  This is the first in a series of blog posts in which I use the R package GGPlot2 to examine real world data. In this post, I construct a line graph of U.S. shoe consumption from 1995 to 2007. A recent survey conducted by Shop Smart magazine found that the average woman in the

Read more »

Running SQL Queries in R With the SQLDF Package

October 16, 2011
By

  The sqldf package can be used to run sql queries on R data frames. The user simply needs to specify a sql statement enclosed by quotation marks within the sqldf() function. In the follow R code, you see various ways of using the sqldf package to run sql queries on R data frames. The sql

Read more »

Regional Variation in Law Enforcement Deaths – Part A

February 15, 2011
By
Regional Variation in Law Enforcement Deaths – Part A

In recent months, there has been a series of high profile incidents in the United States where police officers were killed. While such events are unfortunate, the data suggests that it is extremely rare for an officer to be harmed or killed while on duty. In this post, I examine whether there are significant regional

Read more »