Tuesday, February 24, 2009

Whipple's index in R

The index measures the degree of age heaping in demographic data. Joerg Baten have been applying it to appraise the numeracy of historical populations. Surely there is neater way to do it, but here is the code in R that I've just written:
tmp1<-data[data>=23 & data<=62]

1 comment:

Colin Wilding said...

Hi Leonardo

Just to say thank you for this - it was just what I wanted.

I turned it into a function like this:


That way you can quickly run it on different subsets, e.g.


n.b. I am not an expert at R so don't assume that this works as intended!