The read.fcat function reads a format catalog
from the file system.  The function accepts a path to the format catalog,
reads the catalog, and returns it.
read.fcat(file_path)The format catalog as an R object.
Other fcat:
as.data.frame.fcat(),
as.fcat(),
as.fcat.data.frame(),
as.fcat.fmt_lst(),
as.fcat.list(),
fcat(),
is.fcat(),
print.fcat(),
write.fcat()
# Create format catalog
c1 <- fcat(num_fmt  = "%.1f",
           label_fmt = value(condition(x == "A", "Label A"),
                             condition(x == "B", "Label B"),
                             condition(TRUE, "Other")),
           date_fmt = "%d%b%Y")
#> # 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
#> # A format catalog: 3 formats
#> - $num_fmt: type S, "%.1f"
#> - $label_fmt: type U, 3 conditions
#> - $date_fmt: type S, "%d%b%Y"
           
# Get temp directory
tmp <- tempdir()            
           
# Save catalog to file system
pth <- write.fcat(c1, dir_path = tmp)
# Read from file system
c2 <- read.fcat(pth)
#> # A format catalog: 3 formats
#> - $num_fmt: type S, "%.1f"
#> - $label_fmt: type U, 3 conditions
#> - $date_fmt: type S, "%d%b%Y"
# Use formats in the catalog
fapply(2, c1$num_fmt)
#> [1] "2.0"
# [1] "2.0"
fapply(c("A", "B", "C", "B"), c1$label_fmt)
#> [1] "Label A" "Label B" "Other"   "Label B"
# [1] "Label A" "Label B" "Other"   "Label B"
fapply(Sys.Date(), c1$date_fmt)
#> [1] "06Oct2025"
# [1] "07Jan2024"