The is.format function can be used to determine if an object is a user-defined format of class "fmt".

is.format(x)

Arguments

x

A user-defined format of class "fmt".

Value

A logical value or TRUE or FALSE.

Details

The is.format function returns TRUE if the object passed is a user-defined format. User-defined formats are defined using the value function. See the value function help for further details.

See also

value to define a format, condition to define the conditions for a format, and fapply to apply the format to a vector.

Other fmt: as.data.frame.fmt(), as.fmt(), as.fmt.data.frame(), condition(), labels.fmt(), print.fmt(), value()

Examples

# Define format
fmt1 <- value(condition(x == "A", "Label A"),
              condition(x == "B", "Label B"), 
              condition(TRUE, "Other"))
#> # A user-defined format: 3 conditions
#>   Name Type Expression   Label Order
#> 1    x    U   x == "A" Label A    NA
#> 2    x    U   x == "B" Label B    NA
#> 3    x    U       TRUE   Other    NA
              
# Check for format
is.format(fmt1)
#> [1] TRUE
# [1] TRUE

is.format("A")
#> [1] FALSE
# [1] FALSE