scan2 {grand} | R Documentation |
scan()
input to a specified formatRestricts scan()
input to a specified format
scan2(prompt, type)
prompt |
string: prompt for user input |
type |
string: required format for input |
user input in specified format
character <- scan2(prompt = "Type any character", type = "character")
numeric <- scan2(prompt = "Type any number", type = "numeric")
integer <- scan2(prompt = "Type any number", type = "integer")
custom <- scan2(prompt = "Yes or No?", type = c("Y","N"))