write_gadget_file: Write Gadget components to file

Description Usage Arguments Value Examples

Description

write_gadget_file is a generic function for the various Gadget filetypes produced by gadgetSim. There are a number of S3 methods corresponding to each Gadget filetype (see below). These functions write the various classes of Gadget filetypes into a text file that can be understood by Gadget. The appropriate components of each respective gadget file type is also written to data files if that is appropriate, and the data in the gadget file type is replaced by the path to that file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
write_gadget_file(gf, file = NULL, path = NULL, output_dir = NULL,
  aggfile_dir = NULL, fit_dir = NULL)

## S3 method for class 'gadget_main'
write_gadget_file(gf, file = "main", path = NULL)

## S3 method for class 'gadget_time'
write_gadget_file(gf, file = "time", path = NULL)

## S3 method for class 'gadget_area'
write_gadget_file(gf, file = "Modelfiles/area",
  path = NULL)

## S3 method for class 'gadget_fleets'
write_gadget_file(gf, file = "Modelfiles/fleet",
  path = NULL)

## S3 method for class 'gadget_stock'
write_gadget_file(gf, file = gf$stockname,
  path = NULL)

## S3 method for class 'gadget_stocks'
write_gadget_file(gf, path = NULL)

## S3 method for class 'gadget_params'
write_gadget_file(gf, file = "params.in",
  path = NULL)

## S3 method for class 'gadget_printfile'
write_gadget_file(gf, file = "printfile.fit",
  path = NULL, output_dir = "out", aggfile_dir = "print.aggfiles",
  fit_dir = NULL)

## S3 method for class 'gadget_likelihood'
write_gadget_file(gf, file = "likelihood",
  path = NULL)

## S3 method for class 'gadget_optinfofile'
write_gadget_file(gf, file = "optinfofile",
  path = NULL)

Arguments

gf

A list of class gadget_main, gadget_time, gadget_area, gadget_stock, gadget_fleet, gadget_printfile, or gadget_params

file

Character. The name of the file to be written

path

Optional. Character of the path of the directory to write files to

output_dir

Character. Path to the directory where printfiles will be written

aggfile_dir

Character. Path to the directory where aggfiles will be written

fit_dir

Optional. Path to sub-directory of Gadget model where optimized files are housed (i.e. WGTS from Rgadget::gadget.fit)

Value

Nothing. Writes the respective Gadget filetype to a text file

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
main <- list(timefile = "time", areafile = "area", stockfiles = "cod")
main <- make_gadget_mainfile(main)
write_gadget_file(main)

# optional use of a path
write_gadget_file(main, path = "model_dir")

## End(Not run)

inspktrgadget/gadgetSim documentation built on May 10, 2019, 9:51 a.m.