I want that only certain numbers can be used as input for the scan() function. Otherwise the input should be repeated until it is valid.
For example, the numbers 1:4 as first input and the numbers 1:8 as second input.
How can I achieve this?
# Only allow 1:4 as first input and 1:8 as second input
input <- scan(what = numeric(), n = 2, quiet = TRUE)