search for: r_levelssymbol

Displaying 2 results from an estimated 2 matches for "r_levelssymbol".

2012 Oct 24
1
Getting ordered factor levels from C
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
2002 Mar 02
1
accessing factor levels from C
Hi, I am trying to get information about factors from a C-program. As I see, the factors are basically integers with attribute ,,levels''. But unfortunately I am not been able to read the levels information. I am using: SEXP variable, levels; ... variable = VECTOR_ELT( data_frame, j); switch( TYPEOF( variable)) { case INTSXP: if( isFactor( VECTOR_ELT( data_frame,