Simple user interface in R to get login details

Occasionally I have to connect to services from R that ask for login details, such as databases. I don’t like to store my login details in the R source code file, instead I would prefer to enter the my login details when I execute the code. Login window Fortunately, I found some old code in a post by Barry Rowlingson that does just that. It uses the tcltk package in R to create a little window in which the user can enter her details, without showing the password. The tcltk package is part of base R, which means the code will run on any operating system. Nice!

Session Info

R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods base


For attribution, please cite this work as:

Markus Gesmann (Jul 15, 2014) Simple user interface in R to get login details. Retrieved from

BibTeX citation:

@misc{ 2014-simple-user-interface-in-r-to-get-login-details,
 author = { Markus Gesmann },
 title = { Simple user interface in R to get login details },
 url = { },
 year = { 2014 }
 updated = { Jul 15, 2014 }