Re: [Rd] Getting ordered factor levels from C

2012-10-24 Thread Mark Lilback
I was banging my head for an hour on this. I just pasted the code into an email and see that I was getting the contents of the SEXP for the factor, not the one returned by getAttrib. Sorry for the waste of time. On Oct 24, 2012, at 4:16 PM, Simon Urbanek wrote: > > On Oct 24, 2012, at 2:14 P

Re: [Rd] Getting ordered factor levels from C

2012-10-24 Thread Simon Urbanek
On Oct 24, 2012, at 2:14 PM, Mark Lilback wrote: > 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'), > o

[Rd] Getting ordered factor levels from C

2012-10-24 Thread Mark Lilback
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