Skip to content
Prev 369596 / 398503 Next

nmax parameter in factor function

I have been trying to understand how the argument 'nmax' works in
'factor' function. R-Documentation states - "Since factors typically
have quite a small number of levels, for large vectors x it is helpful
to supply nmax as an upper bound on the number of unique values."

In the code below what is the reason for error when value of nmax is
24. Why did the same error not occur with nmax = 25  and also how come
there are 26 levels when nmax = 25 ?
[1] a b c d e f g h i j k l m n o p q r s t u v w x y z
Levels: a b c d e f g h i j k l m n o p q r s t u v w x y z
[1] a b c d e f g h i j k l m n o p q r s t u v w x y z
Levels: a b c d e f g h i j k l m n o p q r s t u v w x y z
Error in unique.default(x, nmax = nmax) : hash table is full