With unclass<- you can circumvent class dispatch on the assignment operator

unclass(x) <- value

Arguments

x

some object

value

the value to be assigned

Value

the modified object

Author

Jens Oehlschlägel

See also

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