The write.flist
function writes a formatting list
to the file system. By default, the formatting list will be written to the
current working directory, using the variable name as the file name. These
defaults can be overridden using the appropriate parameters. The catalog
will be saved with a file extension of ".flist".
write.flist(x, dir_path = getwd(), file_name = NULL)
The formatting list to write.
The directory path to write the catalog to. Default is the current working directory.
The name of the file to save the catalog as. Default is the name of the variable that contains the formatting list. The ".flist" file extension will be added automatically.
The full path of the saved formatting list.
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()
,
read.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)
# Create sample data
dat <- c(12.3844, 292.28432)
# Use formats in the catalog
fapply(dat, fr)
# [1] " 12.4" "292.28"