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)

Arguments

x

The formatting list to write.

dir_path

The directory path to write the catalog to. Default is the current working directory.

file_name

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.

Value

The full path of the saved formatting list.

Examples

# 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"