View source: R/write_data_file.R
write_data_file | R Documentation |
The resulting file has the format required by the load_data()
function.
In the future, this step could be bypassed by creating the list output
from load_data()
directly. Only one data set is supported (NDataSet = 1).
This function is based on a subset of the RunFn() function in the older ADMB
version of this package.
write_data_file(
dat,
dir = getwd(),
file_name = "data.dat",
minage = 0,
maxage = NULL,
refage = NULL,
minusage = NULL,
plusage = NULL
)
dat |
Dataframe or tibble with columns for each reader and rows for
each age reading combination. This could either have a count column or
not. If not, |
dir |
Directory where the data file will be saved. |
file_name |
Name of the data file. |
minage |
An integer, specifying the minimum possible "true" age. |
maxage |
An integer, specifying the maximum possible "true" age. |
refage |
An arbitrarily chosen age from which "true" age-composition fixed-effects are calculated as an offset. This has no effect on the answer but could potentially effect estimation speed. By default this will be set to the maxage / 4. |
minusage |
The minimum age for which an age-specific age-composition is
estimated. Ages below
,
where beta is an estimated log-linear trend in the "true"
proportion-at-age. If |
plusage |
Identical to |
Invisibly returns the path to the data file (file.path(dir, file_name)
).
Ian G. Taylor, James T. Thorson, Ian J. Stewart, Andre E. Punt
write_files()
, write_specs_file()
, load_data()
, tally_repeats()
data_test <- data.frame(
reader1 = c(7, 10, 7, 6, 6, 10, 7, 9, 8, 10, 10, 5, 6, 7, 9, 7, 7, 5, 8, 5),
reader2 = c(8, 10, 7, 6, 6, 10, 7, 9, 8, 10, 10, 5, 6, 7, 9, 7, 7, NA, NA, NA),
reader3 = c(7, 10, 7, 6, 6, 8, 7, 9, 8, 10, 10, 5, 6, 7, NA, NA, NA, 5, 8, 5)
)
data_file <- write_data_file(data_test, dir = tempdir(), file_name = "test.dat")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.