write_objects_list: Write all data frames and plots from a list of objects into a...

View source: R/write_objects_list.R

write_objects_listR Documentation

Write all data frames and plots from a list of objects into a directory

Description

Write a list of tables (data frames) and plots (ggplots; as used by fasstr) into a directory. Objects that are not class "data.frame" or "gg" will not be saved. Each table and plot will be named by the object name in the list.

Usage

write_objects_list(
  list,
  folder_name,
  table_filetype,
  plot_filetype,
  width,
  height,
  units = "in",
  dpi = 300
)

Arguments

list

List of data frames and plots to write to disk.

folder_name

Name of folder to create on disk (if it does not exist) to write each plot from list. If using combined_pdf argument, then it will be the name of the PDF document.

table_filetype

Table file type to write. One of 'csv', 'xls', or 'xslx'.

plot_filetype

Image type to write. One of 'png', 'eps', 'ps', 'tex', 'pdf', 'jpeg', 'tiff', 'bmp', or 'svg'. Image type will be overwritten if using combined_pdf is used.

width

Numeric plot width in units. If not supplied, uses the size of current graphics device.

height

Numeric plot height in units. If not supplied, uses the size of current graphics device.

units

Character string plot height and width units, one of 'in', 'cm', or 'mm'. Default 'in'.

dpi

Numeric resolution of plots. Default 300.

Examples

## Not run: 

# Working examples:

# Example list of tables and plots to save
frequency <- compute_annual_frequencies(station_number = "08NM116")

# Write objects in a folder
write_objects_list(list = frequency, 
                   folder_name = "Frequency Analysis",
                   table_filetype = "xlsx", 
                   plot_filetype = "png")
                   

## End(Not run)

fasstr documentation built on Sept. 30, 2024, 9:24 a.m.