plot_handler: Single call for saving and displaying plots

Description Usage Arguments Value

View source: R/helper_functions.R

Description

Single call for saving and displaying plots

Usage

1
plot_handler(plot_logical, output_path, plot_call, plot_name)

Arguments

plot_logical

logical; TRUE if a plot should be displayed in the default graphics device, FALSE if no plot should be displayed.

output_path

string; path to the directory where the figure should be saved. If the directory does not already exist, it will be created. If there is already a figure in the directory with the same name, it will be overwritten.

plot_call

plot; either the code to generate a plot (ex: plot(1:10)) or an active binding to code that generates a plot.

plot_name

string; name that should be given to the figure. Do not include ".pdf".

Value

Either a figure output to the default graphics device, a saved pdf, or both.


smmueller/plotdesignr documentation built on Jan. 5, 2022, 10:55 a.m.