How to assign something to rows of df with selected columns

This is relatively simple, so I reverse engineered res, but see the FAQ: How to do a minimal reproducible example reprex for beginners for what to do to post questions that don't require community contributors to do reverse engineering.

res <- rep("1",9)
res[2:9] <- gsub("1","2",res[2:9])
res
#> [1] "1" "2" "2" "2" "2" "2" "2" "2" "2"

Created on 2022-11-16 by the reprex package (v2.0.1)