I am using ACS micro data (PUMS) with one of the columns as a
factor for the place of birth (POBPF). I would like to create
a column (POBR) containing a rank
corresponding to the place of the observation
in the POBPF rankings.
I wrote a blog entry on my solution:
Hi all,
I am using ACS micro data (PUMS) with one of the columns as a
factor for the place of birth (POBPF). I would like to create
a column (POBR) containing a rank
corresponding to the place of the observation
in the POBPF rankings. For example,
if a person is from Oregon, Oregon is
the
Here's a way to get to your solution, but it's not very pretty:
testdfr - data.frame(POB=c(Oregon,Oregon,Oregon,New
York,California,California))
nstates - length(unique(testdfr$POB))
testdfr$ POBR - c(nstates:1)[table(testdfr$POB)][testdfr$POB]
Hmm I will have to think on that for
Here's a way to get to your solution, but it's not very pretty:
testdfr - data.frame(POB=c(Oregon,Oregon,Oregon,New
York,California,California))
nstates - length(unique(testdfr$POB))
testdfr$ POBR - c(nstates:1)[table(testdfr$POB)][testdfr$POB]
greetings,
Remko
4 matches
Mail list logo