> > 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 a while.... An ugly solution is still better than no solution, but that doesn't quite make sense to me yet. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.