I also often get confused with the different back-reference symbols used for capture groups. Some languages use $1, others \1. R uses the latter but you need to escape the backslash for it to work properly:
library(stringr)
str_vec <- c("TodayILiveInTheUSAWithSimon", "USAToday", "IAmSOOOBored")
str_replace_all(str_vec, "((?<=[a-z])[A-Z]|[A-Z](?=[a-z]))", " \\1")
#> [1] " Today I Live In The USA With Simon" "USA Today"
#> [3] "I Am SOOO Bored"