check_formats: Check if a format or alignment is supported

check_formatsR Documentation

Check if a format or alignment is supported

Description

Utility functions for checking formats and alignments.

Usage

is_valid_format(x, stop_otherwise = FALSE)

check_aligns(algn)

Arguments

x

(string or function)
format string or an object returned by sprintf_format()

stop_otherwise

(flag)
whether an error should be thrown if x is not a valid format.

algn

(character)
a character vector that indicates the requested cell alignments.

Value

  • is_valid_format returns TRUE if x is NULL, a supported format string, or a function, and FALSE otherwise.

  • check_aligns returns TRUE if the provided alignments are supported, otherwise, an error is thrown.

Note

If x is a function, no check is performed to verify that it returns a valid format.

Examples

is_valid_format("xx.x")
is_valid_format("fakeyfake")

check_aligns(c("decimal", "dec_right"))


formatters documentation built on Sept. 13, 2024, 1:10 a.m.