I have an R character vector: 

```
a<-'aabbccaabbccaabbcc'

```

I want to replace the last occurrence of 'aa' and anything that follows with 'bb'.
I tried using `stri_replace_last` of `stringi` package with regex `(.*)aa(.*)`. But it replaces everything as it is a single string.

Is there any way to do this in R?