You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DT[i ,factor := factor] does not respect RHS factor levels #2403
I think the second assignment is treating the RHS as a character type, and then converts back to factor with levels in the order of the data. This would follow the rule:
When LHS is a factor column and RHS is a character vector with items missing from the factor levels, the new level(s) are automatically added (by reference, efficiently), unlike base methods.
Activity
MichaelChirico commentedon Nov 8, 2026
This is fixed on
master:MichaelChirico commentedon Nov 9, 2026
Closed by #3906 and #3909