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")