[R] subset of string by index

david h shanabrook dhshanab at acad.umass.edu
Sun Aug 8 16:50:42 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