Re: [Rd] Convert STRSXP or INTSXP to factor

2019-07-16 Thread Martin Maechler
> Gabriel Becker > on Mon, 15 Jul 2019 13:29:28 -0700 writes: > Hi Morgan, > So if the goal is output identical to calling factor, one thing youc an > do is construct and evaluate a call to the R-level factor function. That > would work and be guaranteed to meet y

Re: [Rd] Convert STRSXP or INTSXP to factor

2019-07-15 Thread Gabriel Becker
Hi Morgan, So if the goal is output identical to calling factor, one thing youc an do is construct and evaluate a call to the R-level factor function. That would work and be guaranteed to meet your requirement. The factor function is implemented with R code, without even any direct calls d

[Rd] Convert STRSXP or INTSXP to factor

2019-07-15 Thread Morgan Morgan
Hi, Using the R C PAI, is there a way to convert to convert STRSXP or INTSXP to factor. The idea would be to do in C something similar to the "factor" function (example below): > letters[1:5] # [1] "a" "b" "c" "d" "e" > factor(letters[1:5]) # [1] a b c d e # Levels: a b c d e There is the func