I'm aware this is not something you should be doing but I guess crashing is not the best way out.
setattr(factor(c(1:3), levels = c("1", "2")), "levels", c("1", "1"))
System info (where it consistently crashes R).
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 5.1
year 2025
month 06
day 13
svn rev 88306
language R
version.string R version 4.5.1 (2025-06-13 ucrt)
nickname Great Square Root
Reactions are currently unavailable
I'm aware this is not something you should be doing but I guess crashing is not the best way out.
System info (where it consistently crashes R).
> version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 crt ucrt system x86_64, mingw32 status major 4 minor 5.1 year 2025 month 06 day 13 svn rev 88306 language R version.string R version 4.5.1 (2025-06-13 ucrt) nickname Great Square Root