Skip to content
Prev 320232 / 398503 Next

Obtaining the internal integer codes of a factor XXXX

On 25/03/2013 11:37 AM, Dan Abner wrote:
seq_len(length(levels(fdata)))

will give you the numeric codes for the levels.  They are simply 1:3 in 
your example above.  (Or perhaps I misunderstood your question?)

Duncan Murdoch