ask {runjags}R Documentation

Obtain Input from User With Error Handling

Description

A simple function to detect input from the user, and keep prompting until a response matching the class of input required is given.

Usage

ask(prompt="?", type="logical", bounds=c(-Inf, Inf), 
   na.allow=FALSE)

Arguments

prompt what text string should be used to prompt the user? (character string)
type the class of object expected to be returned - "logical", "numeric", "integer", "character". If the user input does not match this return, the prompt is repeated
bounds the lower and upper bounds of number to be returned. Ignored if type is "logical" or "character"
na.allow if TRUE, allows the user to input "NA" for any type, which is returned as NA

Author(s)

Matthew Denwood m.denwood@vet.gla.ac.uk funded as part of the DEFRA VTRI project 0101.

See Also

readline, menu

Examples

#  Ask the user if they want to proceed
## Not run: 
ask_yn("Do you want to start the program now?  ", type="logical")
## End(Not run)

[Package runjags version 0.9.3-3 Index]