1、
> a <- letters[1:10] > a [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" > replace(a, c(1, 3, 5), "xxx") ## 替换指定索引的字符串为特定的字符串 [1] "xxx" "b" "xxx" "d" "xxx" "f" "g" "h" "i" "j"