The read.flist function reads a formatting list
from the file system. The function accepts a path to the formatting list,
reads the list, and returns it.
read.flist(file_path)The formatting list as an R object.
Other flist:
as.data.frame.fmt_lst(),
as.flist(),
as.flist.data.frame(),
as.flist.fcat(),
as.flist.list(),
as.flist.tbl_df(),
flist(),
is.flist(),
print.fmt_lst(),
write.flist()
# Create formatting list
fl <- flist(f1 = "%5.1f",
f2 = "%6.2f",
type = "row")
# Get temp directory
tmp <- tempdir()
# Save formatting list to file system
pth <- write.flist(fl, dir_path = tmp)
# Read from file system
fr <- read.flist(pth)
#> # A formatting list: 2 formats
#> - type: row
#> - simplify: TRUE
#> Name Type Expression Label Order Factor
#> 1 f1 S %5.1f NA NA
#> 2 f2 S %6.2f NA NA
# Create sample data
dat <- c(12.3844, 292.28432)
# Use formats in the catalog
fapply(dat, fr)
#> [1] " 12.4" "292.28"
# [1] " 12.4" "292.28"