Blog Archives

Getting data in and out of R

October 22, 2012
By
Getting data in and out of R

One of the great advantages of R is that it recognizes almost any data format that you can throw at it. There are a myriad of different possible file formats but I'll concentrate on the four files that we see almost exclusively in public health: Excel ...

Read more »

What a nice looking scatterplot!

October 15, 2012
By
What a nice looking scatterplot!

This week, we look at plotting data using scatterplots. I'll definitely have a post on other ways of plotting data, like boxplots or histograms.Our data from last week remains the same:First, a quick way to look at all of your continuous variables at once is just to do a plot command of your data....

Read more »

Summarizing Data

October 8, 2012
By
Summarizing Data

In this post, I'll go over four functions that you can use to nicely summarize your data.  Before any regression analysis, a descriptive analysis is key to understanding your variables and the relationships between them.  Next week, I'll have...

Read more »

Quick and Easy Subsetting

October 1, 2012
By
Quick and Easy Subsetting

Public health datasets can be enormous and difficult to look at.  Often it is great to be able to only look at specific parts of the dataset, or to only run analysis on a specific part of a dataset.  There are two ways that you can subset a d...

Read more »

From continuous to categorical

September 24, 2012
By
From continuous to categorical

During data analysis, it is often super useful to turn continuous variables into categorical ones.  In Stata you would do something like this:gen catvar=0replace catvar=1 if contvar>0 & contvar<=3replace catvar=2 if contvar>3 & co...

Read more »

The infamous apply function

September 23, 2012
By
The infamous apply function

For R beginners, the apply() function seems like a secret doorway into programming bliss. It seems so powerful, and yet, beyond reach. For those just starting out, examples of how to use apply() can really help with the intuition of how to h...

Read more »