Can you be more specific? What error message are you getting?
As you can see this works
library(stringr)
str_to_title("AAA")
#> [1] "Aaa"
Created on 2020-11-09 by the reprex package (v0.3.0.9001)
Can you provide a proper REPRoducible EXample (reprex) illustrating your issue?