Utility functions for checking formats and alignments.
Arguments
- x
(
string
orfunction
)
format string or an object returned bysprintf_format()
- stop_otherwise
(
flag
)
whether an error should be thrown ifx
is not a valid format.- algn
(
character
)
a character vector that indicates the requested cell alignments.
Value
is_valid_format
returnsTRUE
ifx
isNULL
, a supported format string, or a function, andFALSE
otherwise.
check_aligns
returnsTRUE
if the provided alignments are supported, otherwise, an error is thrown.
Examples
is_valid_format("xx.x")
#> [1] TRUE
is_valid_format("fakeyfake")
#> [1] FALSE
check_aligns(c("decimal", "dec_right"))