> I'm trying to use the regexpr function to locate the decimal in a character > string. Regardless of the position of the decimal, the function returns 1. You need to escape it. > gsub("\\.",",","Female.Alabama") [1] "Female,Alabama"