powered by
str_sub<-
str_sub(string, start = 1L, end = -1L) <- value
start
end
x <- "BBCDEF" str_sub(x, 1, 1) <- "A"; x str_sub(x, -1, -1) <- "K"; x str_sub(x, -2, -2) <- "GHIJ"; x str_sub(x, 2, -2) <- ""; x
Run the code above in your browser using DataLab