Stage 1

R Is Not So Hard! A Tutorial, Part 16: Counting Values within Cases

August 19th, 2014 by


SPSS has the Count Values within Cases option, but R does not have an equivalent function. Here are two functions that you might find helpful, each of which counts values within cases inside a rectangular array. (more…)


When a Variable’s Level of Measurement Isn’t Obvious

July 14th, 2014 by

A central concept in statistics is a variable’s level of measurement. It’s so important to everything you do with data that it’s usually taught within the first week in every intro stats class.

But even something so fundamental can be tricky once you start working with real data. (more…)


R Is Not So Hard! A Tutorial, Part 13: Box Plots

March 17th, 2014 by

In Part 13, let’s see how to create box plots in R. Let’s create a simple box plot using the boxplot() command, which is easy to use. First, we set up a vector of numbers and then we plot them.

Box plots can be created for individual variables or for variables by group (more…)


R is Not So Hard! A Tutorial, Part 12: Creating Histograms & Setting Bin Widths

March 7th, 2014 by

I’m sure you’ve heard that R creates beautiful graphics.

It’s true, and it doesn’t have to be hard to do so.  Let’s start with a simple histogram using the hist() command, which is easy to use, but actually quite sophisticated.

First, we set up a vector of numbers and then we create a histogram.

B <- c(2, 4, 5, 7, 12, 14, 16)
hist(B)

image001

That was easy, but you need more from your histogram. (more…)


R Is Not So Hard! A Tutorial, Part 11: Creating Bar Charts

January 28th, 2014 by

Let’s create a simple bar chart in R using the barplot() command, which is easy to use.

First, we set up a vector of numbers. Then we count them using the table() command, and then we plot them.

The table() command creates a simple table of counts of the elements in a data set.

H <- c(2,3,3,3,4,5,5,5,5,6)

Now we count the elements using the table() command, as follows: (more…)


R Is Not So Hard! A Tutorial, Part 9: Sub-setting

December 2nd, 2013 by

In Part 9, let’s look at sub-setting in R. I want to show you two approaches.

Let’s provide summary tables on the following data set of tourists from different nations, their gender and numbers of children. Copy and paste the following array into R. (more…)