Articles by Slawa Rokicki

Basics of Histograms

December 22, 2012 | Slawa Rokicki

Histograms are used very often in public health to show the distributions of your independent and dependent variables.  Although the basic command for histograms (hist()) in R is simple, getting your histogram to look exactly like you want takes g... [Read more...]

Data types part 4: Logical class

November 30, 2012 | Slawa Rokicki

First, an update:  A commentator has asked me to post my code so that it is easier to practice the examples I show here.  It will take me a little bit of time to get all of my code for past posts well-documented and readable, but I have uploa... [Read more...]

Data types, part 3: Factors!

November 21, 2012 | Slawa Rokicki

In this third part of the data types series, I'll go an important class that I skipped over so far: factors.Factors are categorical variables that are super useful in summary statistics, plots, and regressions. They basically act like dummy variables t... [Read more...]

Getting data in and out of R

October 22, 2012 | Slawa Rokicki

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 | Slawa Rokicki

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 ... [Read more...]

Summarizing Data

October 8, 2012 | Slawa Rokicki

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 | Slawa Rokicki

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 | Slawa Rokicki

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 & contvar3 & co... [Read more...]

The infamous apply function

September 23, 2012 | Slawa Rokicki

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...]
1 2

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)