From mlilback at stat.wvu.edu  Wed Oct 24 20:14:07 2012
From: mlilback at stat.wvu.edu (Mark Lilback)
Date: Wed, 24 Oct 2012 14:14:07 -0400
Subject: [Rd] Getting ordered factor levels from C
Message-ID: <574D6602-6F6E-4EB3-99A6-6E1651A65D1B@stat.wvu.edu>

I'm working on an R package in C and can't seem to get the same level information about a factor that the R console displays.

If I define a factor as:

lvls <- factor(c('red','blue','blue','green','red'), c('blue','green','red'), ordered=TRUE)

When I get the "levels" attribute in C, I get back the the first vector, not the second. If I run attr(lvls,"levels") in R, I get back the second vector. There are no attributes besides class and levels, so how do I get the list of levels in the correct order?

Thanks

-- 
Mark Lilback
West Virginia University Department of Statistics
mlilback at stat.wvu.edu



[Rd] Getting ordered factor levels from C
Mark Lilback