To hide user input in R, you can make use of the readline
function along with the suppressMessages
function.
The readline
function prompts the user to enter input and returns the entered input as a string. The suppressMessages
function is used to suppress any messages that might be displayed during the execution of the readline
function.
To hide user input in R, you can do the following:
main.r59 chars2 lines
In the above code, the user will be prompted to enter a password, but the input will not be displayed on the console as the suppressMessages
function will suppress it.
You can then use the password
variable to work with the user input without ever displaying it on the console.
gistlibby LogSnag