A function for generating a consistent file system for data files and visualizations. If none of the parameters are set the full path generated by this function will be root_path/output

output_dir(start_path = NULL, experiment = NULL, plot_type = NULL,
  end_path = NULL, root_path = NULL, custom_path = NULL,
  overwrite = FALSE, mkdir = TRUE)

Arguments

start_path

With the start_path set, the full path generated by this function will be root_path/start_path/?experiment?/?plot_type?/end_path. Default: NULL

experiment

(optional) This will add a second level to the start_path file system. Default: NULL

plot_type

(optional) This will add a third level to the start_path file system. With ONLY the plot_type set the full path generated by this function will be root_path/plot_type. Default: NULL

end_path

(optional) This will add the final directory to the start_path file system Default: A formatted date-time string.

root_path

The root of the new file system (start_path or not). Default: The working directory.

custom_path

This is an absolute path that overrides everything else. Default: NULL

overwrite

A logical denoting that overwriting is acceptable. Default: FALSE

mkdir

A logical denoting weather or not the directory should be created or not. Default: TRUE

Value

Creates a directory for output and returns the path as a string.

Details

This function is incredibly useful on it's own but also for various other plotting/saving functions within the package. It helps keep data organized using a standard workflow.

See also

Examples

# NOT RUN {
if(interactive()){
 # Get the path to an output directory without creating
 library(MicrobiomeR)
 output_dir <- output_dir(start_path="output", experiment="microbiome-proj", mkdir=FALSE)
 print(output_dir)

 # Create a folder for your plot types
 output_dir <- output_dir(plot_type="scatter-plots")
 print(output_dir)

 }
# }