[R] subset of string by index

david h shanabrook dhshanab at acad.umass.edu
Sun Aug 8 17:05:06 CEST 2010


How can I get a substring based on the index into the string?

strM <- c("abcde", "cdefg")
ind <- c(1,3,5)

I want to use ind to index into the strings so the result is:

strMind <- c("ace", "ceg")



More information about the R-help mailing list