Description Usage Arguments Details Value Author(s) See Also Examples
The function checks if a given character string, e.g. value from readline
, matches one element of on a given character vector.
Without match it keeps asking for a character string by readline
until 'q' for quit or a matching string is provided.
This is often used to avoid crashing of functions due to wrong input in the options.
1 | check_readline(x, myletters)
|
x |
character vector to be checked, e.g. value from |
myletters |
character vector of entries which should be allowed, e.g. c("yes", "no") |
Usage is e.g. yesno = check_readline(yesno, c("y", "n") Now the function will make sure that the variable x consists either of "y" or of "n".
character vector with one of the values given in myletters
Solveig Pospiech
Other sub functions: relError_dataset
,
select.VarsElements
1 2 3 4 5 | possibleEntries = c("today", "yesterday")
myEntry = "today"
# or try another entry which is different from "today":
# myEntry = readline("Enter any word (without quotes): ")
y = check_readline(x = myEntry, myletters = possibleEntries)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.