userInput: userInput let the user type in a character string

View source: R/userInput.R

userInputR Documentation

userInput let the user type in a character string


this is useful for asking the user for a username or password, so that it goes directly to a variable and doesn't get inadvertently saved into an R script. There are no arguments. This will only return a character string. This is low key, don't bother using it for data entry. Just type characters, no need to put it in quotes, pressing enter will cause the function to return. Output will not be printed to the console, but it can be assigned directly. This is useful to have as an auxiliary function in case multiple calls to functions such as readHMDweb() are desired.


userInput(silent = FALSE)



logical should a little prompt be given, telling the user to enter text in the console?


a character string, as given by the user.


### mypassword <- userInput()
### myusername <- userInput()
### DAT <- readHMDweb("USA","mltper_1x1",mypassword,myusername)

HMDHFDplus documentation built on Feb. 16, 2023, 8:34 p.m.