Writes the result tables of a joinpoint fit to delimited text files, one
file per table: data and modeled values, APCs, AAPCs, joinpoint
locations, model estimates, model selection (criteria, permutation tests,
data dependent selection, MADWD and the final selected models with their
search limits), coefficient covariances, jump estimates, pairwise and
AAPC comparisons, clustering tables, skipped cohorts, the centered
covariate design, a supplied covariance matrix and every setting of the
run. saveRDS() keeps the complete fitted object.
Usage
jp_export(
object,
dir,
prefix = "joinpoint",
model = c("all", "final"),
comparison = NULL,
sep = ","
)Arguments
- object
A
joinpointorjp_clusterobject.- dir
Output directory (created if needed).
- prefix
File name prefix, without a folder.
- model
"all"(every fitted model) or"final".- comparison
Optional result of
jp_compare()to export with the fit.- sep
Field separator.
Details
The files of an earlier export to the same directory with the same prefix that this export does not write (tables that do not apply to this fit) are removed, so the directory always holds one consistent set.
Examples
tb <- subset(us_mortality, cause == "Tuberculosis")
fit <- joinpoint(tb, year, rate, kmax = 2, ci_method = "parametric")
dir <- file.path(tempdir(), "joinpoint-example")
files <- jp_export(fit, dir)
basename(files)
#> [1] "joinpoint.Data.txt"
#> [2] "joinpoint.APCs.txt"
#> [3] "joinpoint.AAPCs.txt"
#> [4] "joinpoint.Joinpoints.txt"
#> [5] "joinpoint.Model.Estimates.txt"
#> [6] "joinpoint.Coefficient.Covariance.txt"
#> [7] "joinpoint.Model.Selection.txt"
#> [8] "joinpoint.Final.Selected.Model.txt"
#> [9] "joinpoint.Run.Summary.txt"
unlink(dir, recursive = TRUE)