Password Input with getPass

April 26, 2016

[This article was first published on R – librestats, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

As of this morning, the getPass package version 0.1-1 is available on CRAN. The package offers a portable way to read user input without echoing the text, for the purposes of reading passwords. Some screenshots from various platforms are given below.


Implementation details are described in the package vignette. The short version is, if you use…

  • RStudio, input is handled by the rstudioapi package
  • command line (any OS), a custom reader written in C is used
  • RGui (Windows), then a tcltk reader is used.
  • (Mac), then we attempt to use tcltk if it is available.

If none of these options is available for your platform/interface, then a backup version without masking can be used, via R’s readline(). I believe this supports just about everything, except emacs+ess, which I don’t think can be supported (if you have any ideas, please let me know). If you discover any problems, please file an issue.

To leave a comment for the author, please follow the link and comment on their blog: R – librestats. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)