With unclass<- you can circumvent class dispatch on the assignment operator
Arguments
- x
some object
- value
the value to be assigned
Value
the modified object
Examples
x <- factor(letters)
unclass(x)[1:3] <- 1L
x
#> [1] a a a 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