dataTemplate: dataTemplate - generates a standard input datafile as a...

View source: R/datalow_utils.r

dataTemplateR Documentation

dataTemplate - generates a standard input datafile as a template

Description

dataTemplate - generates a standard input datafile to use as a template. It is possible to define the number of blocks and then, once the data file is created, go in and edit it appropriately to suit exactly the data you have for your own species. Note that in the example commas are used to separate individual data fields, this is required if you are going to use the function 'readdata' to get your data into datalowSA, which is recommended. But of course you are free to use it however you wish! Each section in the data file, except the title, is identified using CAPITAL letters, as in RESILIENCE, NYRS, YEARS, etc. These, again are needed by 'readdata' to identify the various sections and proceed to reading that data in appropriately. If you do not have data for a section just delete it entirely, including the heading. DO NOT use a section heading name anywhere else in the document as 'readdata' will always try to use the first instance which could cause you trouble. The example AGE data comes from Table 13.1 in Beverton and Holt (1957) and consists of ageing data from North Sea plaice. Tw sexes have been given here to illustrate the use of age by sex (female first row for a year, males in the second row for a year), but zeros are given for males, The numbers at length are pure fiction and again are merely here to illustrate the format.

Usage

dataTemplate(filename = "constants.csv", title = "SpeciesName")

Arguments

filename

- the name for the generated datafile, character string, defaults to tmpdat.csv

title

the first line of the data file; identify its contents

Value

a standard definition data file ready to be read by readdata and it also outputs the full address of the filename.

Examples

## Not run: 
dataTemplate(filename="fishery1.csv")
ans <- readdata("fishery1.csv")
str(ans)

## End(Not run)                   # filename="C:/Users/had06a/Dropbox/Public/fishery1.csv"

haddonm/datalowSA documentation built on Nov. 5, 2023, 6:40 p.m.