More than 9 backreferences in gsub()

后端 未结 6 1630
温柔的废话
温柔的废话 2021-02-20 06:01

How to use gsub with more than 9 backreferences? I would expect the output in the example below to be \"e, g, i, j, o\".

> test <- \"abcdefghijklmnop\"
&g         


        
6条回答
  •  眼角桃花
    2021-02-20 06:17

    Use strsplit instead:

    test <- "abcdefghijklmnop"
    strsplit(test, "")[[1]][c(5, 7, 9, 10, 15)]
    

提交回复
热议问题