Check that a variable is a single character string meeting specified requirements
simpleCharArg(name.arg, val.arg, default, accepted, lower = TRUE, clean = TRUE)
The resulting parameter value
Name of the argument
argument value
If val.arg is NULL, what should be returned?
What values are allowed
run tolower?
clean white spaces?
Better options may be available in packages like checkmate. This function doesn't only check the parameter value, it also sets it to the default value if missing.