save_file: Save a file

Description Usage Arguments Value Author(s) Examples

View source: R/package_functions.R

Description

The function uses the file extension to select the appropriate save function to use. By default it uses get_output_dir to set the output directory to save the output to. By default, get_output_dir sets the working to directory to mimic the folder structure of "Output" to "Codes" by finding the folder path of the current R script.

Usage

1
2
3
4
5
save_file(..., file = NULL, file.override = NULL, row.names = F,
  showProgress = F, paper = "USr", combine = F, width = 9,
  height = 5, units = "in", pointsize = 12, bg = "white",
  fg = "black", res = 300, append = F, plot = last_plot(),
  doc = F)

Arguments

...

An object to be saved, including any other arguments to be passed to the save function associated with the file extension.

file

A character string giving the name of the file, including the extension, to be saved.

file.override

A character string giveing the full file path if want to override the default the output directory.

plot

If wanting to save a ggplot object, plot should be assigned the ggplot object.

doc

Boolean (T, F) to change output directory to Documenation instad of Output. Default is F.

...

Other arguments to pass to data.tables fread, the base load or readRDS, or writexl's write_xlsx.

Value

A data object (data.table or data.frame).

Author(s)

Alex Hubbard (hubbard.alex@gmail.com)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data = data.table(x = 1:10, y = 1:10)
save_file(data, file = "data.RData")

g = ggplot(data) +
  ggtitle("Example Plot", subtitle = "Simple Plot") +
  geom_line(aes(x = x, y = y)) +
  od_theme(colors = "blue")

save_file(plot = g, file = "plot.png")

g
save_file(file = "plot.png")

opendoor-labs/projectmap documentation built on Oct. 8, 2019, 1:58 p.m.