The secret
package is good, but I also have been known to make gratuitous use of passwords in environment variables. I pop them in my .Rprofile
like this:
Sys.setenv( MY_UID='your_UID')
Sys.setenv( MY_PWD='your_password')
then in R I can call Sys.getenv("MY_UID")
anywhere I need my UID, for example.