“substr()” is
used to extract or replace substrings in a character vector.
Usage
substr(x,
start, stop)
substr(x, start, stop) <- value
substr(x, start, stop) <- value
> x <- "Hello How are you" > > substr(x, 7, 9) [1] "How" > > substr(x, 7, 9) <- "who" > x [1] "Hello who are you"
substr(x, 7, 9) <- “who”
Above statement replace “how” by “who”.
Above statement replace “how” by “who”.
No comments:
Post a Comment