Skip to contents

Function to export specified object from R environment found in the stock assessment report.

Usage

export_object(object = NULL, file_format = "docx", subdir = NULL)

Arguments

object

table, plot, or other object in the environment to export for reference outside of the report document

file_format

pdf, docx, xlsx, csv, rdata; default is docx

subdir

directory where to export the object

Value

Objects put through this function will be put into the folder "exported" for better organization; DO NOT PUSH THESE TO THE REPO

Author

Samantha Schiano

Examples

source <- c("NMFS Groundfish Survey", "", "U.S. Trawl Fisheries", "", "")
data <- c("Survey biomass", "Age Composition", "Catch", "Age Composition", "Length Composition")
years <- c(
  "1984-1999 (triennial), 2001-2013 (biennial)",
  "1984, 1987, 1990, 1993, 1996, 1999, 2003, 2005, 2007, 2009, 2011", "1961-2013",
  "1990,1998-2002, 2004, 2005, 2006, 2008, 2010", "1963-1977, 1991-1997"
)
test_obj <- data.frame(source, data, years)

export_object(object = test_obj, file_format = "csv", subdir = "~")