我有以下向量:
test <- c("here is some text", "here is some other text", "here is my formula", "2+2", "here is my second formula", "4+4", "here is even more text", "here is my final formula", "6+6")
我希望做的是获取一个包含"FORMULA"的字符串的每个实例,并在其前面插入一个类似"ccc"的随机字符串,这样我就会得到如下所示:
test <- c("here is some text", "here is some other text", "CCC", "here is my formula", "2+2", "CCC", "here is my second formula", "4+4", "here is even more text", "CCC", "here is my final formula", "6+6")