hide user input in r

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.r
password <- suppressMessages(readline("Enter password: "))
59 chars
2 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.

related categories

gistlibby LogSnag